简体   繁体   中英

Auto Increment column on SELECT Mysql 8

MySql 8

I have this table :

id name count
1 name1 3
2 name2 4

I'm looking for a way to increment count each time I get the count value.

Something like:

SELECT count FROM table WHERE id = 1 AND /*increase count value*/;

So this request will return: 3

Then if I do:

SELECT * FROM table;

I got:

id name count
1 name1 4
2 name2 4

I'm assuming I have to use an Index but I can't figure out how.

Thank you

As @Xammax's answer didn't suit my need, I change my database from mysql to postgre and use this answer: Return updated row attributes on UPDATE

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