Good thing MySQL has the IF() function that enables us to update a column by switching values to 0 if current value is 1 and vice versa in just 1 query.

This way, we do not have to waste resources by querying for the current value and then executing an update query.

Related Posts Plugin for WordPress, Blogger...