Is there a way to SELECT and UPDATE rows at the same time?

后端 未结 9 1550
醉话见心
醉话见心 2020-12-12 21:01

I\'d like to update a set of rows based on a simple criteria and get the list of PKs that were changed. I thought I could just do something like this but am worried about po

9条回答
  •  渐次进展
    2020-12-12 21:08

    Edit: my bad, you wanted the select to show results after the update, not update from a select.

    Have you tried a sub-select?

    update mytable set mydate = sysdate 
    where mydate in (select mydate from mytable where mydate is null);
    

提交回复
热议问题