salve. vorrei sapere se è possibile ritornare, dopo un update, il valore modificato.
es:
UPDATE tracklist SET countview=countview+1 WHERE nome='mario'
in questo caso, se countview contiene per esempio il valore 21, vorrei ritornare 22 dopo questa chiamata SQL (oppure anche il semplice 21, e poi lo incremento lato server con un ++).
ho letto questa guida , dove dice :
"Sometimes you have a lot of processes that could be updating a column value in a table. If you want to return the value before you updated it without using a seperate select (which unless you lock the table could return a different value than is updated) then you can use a mysql variable like this:
update some_table
set col = col + 1
where key = 'some_key_value'
and @value := col
The @value := col will always evaluate to true and will store the col value before the update in the @value variable.
You could then do
select @value;
in order to see what the value was before you updated it"
ho provato a mettere quel select @value alla fine della query update, ma come mi aspettavo non funziona.
cordiali saluti