You could adjust your input to have Firstname, Lastname as different inputs. You could also just do: WHERE (lastname LIKE '%Ray%' OR lastname like '%Hunter%') AND (firstname like '%Ray%' OR firstname like '%Hunter%');
On Thu, Jul 18, 2013 at 7:03 PM, Wade Shearer <[email protected]>wrote: > Imagine a database with first and last names in separate columns. I need > to be able to search by "<first name> <last name>" or "<last name> <first > name>". Is there a better way than this? > > SELECT lastname, firstname > FROM wherever > WHERE (CONCAT(lastname, ', ', firstname) LIKE "%Ray Hunter%" OR > CONCAT(firstname, ' ', lastname) LIKE "%Ray Hunter%" ) > > _______________________________________________ > > UPHPU mailing list > [email protected] > http://uphpu.org/mailman/listinfo/uphpu > IRC: #uphpu on irc.freenode.net > -- Take care, William Attwood Idea Extraordinaire [email protected] _______________________________________________ UPHPU mailing list [email protected] http://uphpu.org/mailman/listinfo/uphpu IRC: #uphpu on irc.freenode.net
