I am creating an event on one of my databases to check if the client changed a specific parameter called ‘serverlog‘ which is a boolean on my Sql database.
Is there a way to loop through all the users in a table called ‘users‘, check if ‘serverlog‘ is false and update/set a different parameter called ‘islogged‘ in the user table. Something like a foreach user loop in SQL
I want to loop through all the users and if ‘serverlog‘ = false then set ‘islogged‘ = false on that user.
Advertisement
Answer
I want to loop through all the users and if ‘serverlog’ = false then set ‘islogged’ = false on that user.
UPDATE users_table SET islogged = FALSE WHERE NOT serverlog;