Forum Moderators: open

Message Too Old, No Replies

MySQL UPDATE based on multiple WHERE variables

Is this possible?

         

hannamyluv

3:13 am on Oct 29, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I need to make updates to a table in sql based on multiple variables, eg I need to tell the database that if a line in the table matches in columns "color", "size" and "shape", make the changes to that line.

Can I do this? If so, what is the proper way to format the command?

syber

3:46 am on Oct 29, 2006 (gmt 0)

10+ Year Member



Just connect the statements with AND

UPDATE mytable
SET mycolumn = 1
WHERE color = 'red' AND size = 'XL' AND shape = 'square'