简体   繁体   中英

how to add + 1 of the last record to mysql c# winform

In general, I have a test. During the passage of which the user receives points. And when another user passes the same test, points are assigned to both the first user and the second

how to assign points to the last user?

my mysql query

MySqlCommand command =
    new MySqlCommand("update `journal` set `balls` = `balls` + 1", db.getConnection());

solving the problem

update journal set balls = balls + 1 where id = LAST_INSERT_ID()

You should get the last data first before you execute update query

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM