Thursday, May 5, 2011

Multiple Update

I'm trying to update two query's in my php script but i can't get it to work. The code is:

UPDATE table SET price = '14.50' WHERE type LIKE 'finger', 'Knuckle' AND quantity <=50;

Okay, ive fixed the WHERE clause but i don't understand what i need to change with the '14.50' part which is now picking up an error?

From stackoverflow
  • UPDATE table SET price = '14.50' WHERE (type LIKE 'finger' OR type LIKE 'Knuckle') AND quantity <=50;
    
  • UPDATE table SET price = '14.50'
    WHERE type IN('finger', 'Knuckle') AND quantity <=50;
    
  • you may also want

    update table set price = '14.50'
    where (type like '%finger%' or type like '%knuckle%')
    and quantity <= 50
    

    This will match any strings in which finger or knuckle are contained.

0 comments:

Post a Comment