Reputation: 67
I'm updating a table like so...
Update table Set count = count + 1 Where id = xx Limit 1
How to get the value of count without querying the table again? Can it be done in one query?
Thank you!
Upvotes: 2
Views: 599
Reputation: 76567
No.
Update does not return a result set.
However you can get the count without having to query the table
UPDATE `table` SET count = @count:= count + 1 WHERE id = 'xx' LIMIT 1;
SELECT @count as LastUpdateCount;
Upvotes: 5