Is it possible to do the following in 1 statement instead of 2.
I need to set the isActive flag for one id and set all the others to false.
Im using postgres DB.
tblNames
------------------------
id,name,isActive
1,'n1',true
2,'n2',false
3,'n3',false
4,'n4',false
update tblnames
set isActive = true
where id = 4
update tblnames
set isActive = false
where id != 4
Does that work?
In case it doesn’t (I don’t know Postgres syntax well enough), this will surely work: