Quantcast
Channel: MySQL Forums - Connector/C++
Viewing all articles
Browse latest Browse all 527

Run multiple update / select from one query (1 reply)

$
0
0
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.

Viewing all articles
Browse latest Browse all 527

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>