On 7/19/13 7:09 AM, Walt Haas wrote: > You didn't specify how the names are organized into their columns. If > 'Ray' could be in either firstname or lastname and the same with > 'Hunter' then use UNION instead of OR > > firstname = 'Ray' AND lastname = 'Hunter' > UNION > lastname = 'Ray' AND firstname = 'Hunter' > > will be faster than using an OR > > If you know which columns they are in just select on that.
That's a good point, although whether it's faster depends on the database. Some (such as MariaDB) will optimize the OR to be the same as your UNION. Steve _______________________________________________ UPHPU mailing list [email protected] http://uphpu.org/mailman/listinfo/uphpu IRC: #uphpu on irc.freenode.net
