MySQL: Updating all rows setting a field to 0, but setting one row's field to 1
UPDATE `table`
SET `inuse` = (`id` = 23)
Sure
UPDATE table SET inuse=IF(id=ABCD, 1, 0)
would set the inuse field to 1 if id is ABCD and 0 otherwise.
UPDATE `table`
SET `inuse` = (`id` = 23)
Sure
UPDATE table SET inuse=IF(id=ABCD, 1, 0)
would set the inuse field to 1 if id is ABCD and 0 otherwise.