sql - MySQL Check if row contains value from another table -
i need check if row in mysql table contains value stored in table.
this trying right now:
select * table1 not exists (select * table2 column = '%');
this still finds rows contain value in second table. have tried exchanging exists , in both return syntax errors.
edit:
using % sign seems cause issue. here screenshots of happens when use percent sign:
one of values stored in second table 'meath', row containing 'meath' still selected. if add 'meath' instead of '%' row isn't returned:
select * table1 a.county not in(select county table2)
this should match want.
edit: if need disregard values table2, replace second line this
where a.county not in(select county table2 county in('county1', 'county2'))
Comments
Post a Comment