0

I want to update a row in my table. After updating I want to select the same row. How can I do this in one query?

Steps to be performed:

  1. UPDATE a row.
  2. Fetch the values in updated row.

Is it possible using a single query?

suyash ghuge
  • 95
  • 2
  • 13
  • 4
    In a word. 'No' – Strawberry Jul 19 '20 at 08:47
  • 1
    Only Postgresql implements it natively, with the `RETURNING` keyword mysql doesn't have that feature, you need to fetch updated records manually after the update – Ertan Kara Jul 19 '20 at 08:56
  • And the docs (postgresql) say: "In an INSERT, the data available to RETURNING is the row as it was inserted. This is not so useful in trivial inserts, since it would just repeat the data provided by the client." – Luuk Jul 19 '20 at 09:00

0 Answers0