0

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?

2
  • LIKE is equivalent to "=" unless you put a wildcard somewhere. Commented May 7, 2009 at 0:40
  • It generally acts the same as =, except that = ignores trailing whitespace for VARCHAR and CHAR types, and = performs transformations according to character collation (so "ae" is equal to "ä"), whereas LIKE doesn't. dev.mysql.com/doc/refman/5.0/en/… For the purpose given in this questions, however, it is safe to treat them equivalently. Commented May 7, 2009 at 1:39

3 Answers 3

4
UPDATE table SET price = '14.50' WHERE type IN('finger', 'Knuckle') AND quantity <=50; 
Sign up to request clarification or add additional context in comments.

Comments

1
UPDATE table SET price = '14.50' WHERE (type LIKE 'finger' OR type LIKE 'Knuckle') AND quantity <=50; 

Comments

0

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.

Comments