[thelist] Re: SQL gurus

Theodore Serbinski stanson at gmail.com
Fri Mar 25 14:33:30 CST 2005


Ok just after I sent this out I had a relevation, doesn't that always
seem to happen, doh!

LEFT JOIN is my friend.

Turned the query into:

SELECT m1.date,m1.mileage,m1.notes,m2.date AS \'match\' FROM m m1 LEFT
JOIN m m2 ON (m1.date=m2.date AND m1.mileage=m2.mileage AND m2.notes
LIKE \'%'.$searchString.'%\')';

Seems to work like a charm. Feel free to chime if you have any other
better solutions. Based on this the "match" field will have the date
value if a match is found... then in PHP I just test to see if this
field isn't null...works great!

ted


More information about the thelist mailing list