testing multiple conditions with like
Posted: Sun Sep 11, 2011 5:34 am
Hi everyone,
I'm looking how to match a name field with 2 database columns
Is this correct? I can't get a match on the second word. (smith) only on john. How can I get a match on the second word as well?
Thanks for any help.
I'm looking how to match a name field with 2 database columns
Code: Select all
SELECT id FROM username WHERE firstname LIKE %john% OR %smith% OR firstname IN ('john smith') AND lastname LIKE %john% OR %smith% OR lastname IN ('john smith')Thanks for any help.