I’m using MySQL’s INSERT INTO...SELECT structure:
INSERT INTO some_table (col1, col2, col3)
SELECT otbl.col4, obtl.col5, atbl.col6 FROM other_table otbl
INNER JOIN another_table atbl
ON atbl.id = otbl.some_id
WHERE obtl.col7 = 0;
In the same query, I want to “toggle on” col7 = 1 wherever the SELECT matched. Possible?
I believe the answer is No. I have wanted to do similar things, like update a user’s login time while selecting their details. In your case, you would have to have two queries, with the update being second. If you need to ensure nothing occurs between them, consider a transaction.