Skip to content
Advertisement

mysql update column then select updated value

I have a table like this

tbl_user

first i want to update a row based on id

now i want to get updated value of amount column i have applied this sql

my question is can i combine both of above sql or any single query to achieve above task?

Advertisement

Answer

The best you could imitate is to use two lines of queries, probably using a variable like:

The best you could do then is to create a Stored Procedure like:

And then call Stored Procedure in your PHP.

Note: PostgreSQL has this kind of option using RETURNING statement that would look like this:

See here

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement