I successfully managed to retrieve users with 2 or less posts from a database and display the result of that query which looks like this:
SELECT Users.*, count( Posts.user_id )
FROM Posts LEFT JOIN Users ON Users.user_id = Posts.user_id
GROUP BY Posts.user_id
HAVING count( Posts.user_id ) < 2
What i would like to achieve next is to update a field called active for all users of that query, so i tried to add an UPDATE statement together with the first query:
UPDATE Users
SET Users.Active = 3
WHERE count( Posts.user_id ) < 2
But i can't get it to work. Where should the UPDATE part be positioned or maybe should it be run separately ?