I have a query which is updating the status of a user passed inside it.
update userinfo set status=1 where id in
(select id from userinfo where name in ('viki','nik','mike'));
Query is working fine.
But problem is suppose ‘nik’ name is not present in the database.
Then query will not work for the remaining users which are after the ‘nik’.
How can i make sure that update query runs for each of them ?
Thanks in advance.
It will work, regardless of whether or not one of the names in your set exists in the
userinfotable.ALSO: Why are you running a second query to get a list of ids from the same table you’re trying to update? Just go: