MySQL Forums
Forum List  »  Connector/C++

Run multiple update / select from one query
Posted by: jupiter hce
Date: November 26, 2017 11:29PM

Hi,

I need a query command to update multiple rows to set the alertState (char(1) to true if any tables match following conditions:

- the last contact time < now - timeout
- the the alertState = false

I tried following command, but it got syntax problems:

update Device set alertState = 1 where (select alertState, lastContact from Device where lastContact < 1511751383) and alertState = 0;

ERROR 1241 (21000): Operand should contain 1 column(s)

Also, is it possible to update multiple rows in one query?

Thank you.

Options: ReplyQuote


Subject
Views
Written By
Posted
Run multiple update / select from one query
3215
November 26, 2017 11:29PM


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.