I want to select a group of data from database by using the code below.
SELECT * FROM History INNER JOIN (SELECT MAX(id) as id FROM History GROUP BY home_id)
last_updates ON last_updates.id = History.id
And the result, i get the group of data. Then i want to update field on the table based on the group of data and i use below code.
UPDATE History SET status = '0' WHERE
(SELECT * FROM History INNER JOIN (SELECT MAX(id) as id FROM History GROUP BY home_id)
last_updates ON last_updates.id = History.id)
I think my sql update code is correct, but i got
Error: Operand should contain 1 column(s).
Is there anything i need to change?