views:

62

answers:

2

i can't seem to figure out how to combine LIKE with an OR or AND:

DELETE * FROM persons WHERE FirstName = 'Abe' AND LastName LIKE '%coln'; 

Looks like it should owrk to me but I get error 1064 (syntax0

Is there a correct way to do this?

+7  A: 

The problem is the asterisk. You don't use it on deletes since you can only delete whole records. Should be:

DELETE FROM persons WHERE persons.FirstName = 'Abe' AND persons.LastName LIKE '%coln';
John Scipione
+2  A: 

Drop the *

DELETE FROM persons WHERE FirstName = 'Abe' AND LastName LIKE '%coln';
RMcLeod