Combining 2 Mysql update statments(same col, different values, different conditions)

Posted by Paul Atkins on Stack Overflow See other posts from Stack Overflow or by Paul Atkins
Published on 2011-01-05T18:45:33Z Indexed on 2011/01/05 18:54 UTC
Read the original article Hit count: 168

Filed under:

Hi guys,

I have been doing some searching but have not been able to find an answer for this so thought I would ask here as the people here know everything :)

I am trying to combine these 2 update queries into one query.

UPDATE addresses SET is_default='0' WHERE id!='1'
UPDATE addresses SET is_default='1' WHERE id='1'

I assume this should be too hard to accomplish but i cant seem to work it out :(

Thanks

Paul

© Stack Overflow or respective owner

Related posts about mysql