MySQL Forums
Forum List  »  Connector/C++

Update and insert in one query
Posted by: nobody nobody
Date: November 27, 2017 12:28AM


I want to update one table and insert to another table in one query, but the insert command cannot see the from the update. Appreciate clues

update Device, (select id, alertState, lastContact from Device where lastContact < 1511765116 and alertState = 0) as statement set Device.alertState = 1 where =; insert Alert (DeviceId, Message) value (, "Alert");

Thank you.

Kind regards,

Options: ReplyQuote

Written By
Update and insert in one query
November 27, 2017 12:28AM

Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.