Mysql – How to UPDATE and SELECT at the same time in MySQL

MySQLselect

With a relationship with this question How UPDATE and SELECT at the same time
and with this code:

UPDATE table SET foo=1 WHERE boo=2

SELECT * from table WHERE foo=1 AND boo=2

How can I UPDATE and SELECT at the same time with MySQL?

It seems the person asking the existing question uses PostgreSQL. How can I do that in MySQL? It seems there is no returning command in MySQL.

Best Answer

Unfortunately, RETURNING is not supported by MySQL and therefore you need to write separate statements.

As an alternative, you can rely on a stored procedure.

The question of whether MySQL has a returning clause equivalent, in general, was addressed here: Mysql returning clause equivalent