Return to Snippet

Revision: 33805
at October 13, 2010 16:18 by powerthru


Initial Code
SELECT a.first, a.last, a.district, a.zip, b.zip, b.first, b.last, b.district 
FROM clerk_ballots a, lcv_members b
WHERE a.first LIKE b.first
AND b.last LIKE a.last
AND INSTR(b.district, a.district)

Initial URL

                                

Initial Description
in this case, we wanted to match fields where the district field in table b contained things like "LAM2-OUTSIDETOWN" and we wanted to match that to fields in table a which only had "LAM2" in them. "INSTR" ("in string") is our friend:

Initial Title
find one string inside another string, comparing two columns

Initial Tags

                                

Initial Language
SQL