>But it I want all records from Table1 that have features 'A01' _and_ 'B02', >clearly >SELECT * from Table1 JOIN Features USING(id) WHERE >Features.FeatureCode='A01' AND Features.FeatureCode='B02' doesn't work.
okay maybe this one is a more stupid and complex solution :) but i think it should work (sorry i havent test it yet :p ) select table1.id from table1 left join features f1 on table1.id=f1.id and f1.featurecode='A01' left join features f2 on table1.id=f2.id and f1.featurecode='B02' . . . (as many as you like) where not isnull(f1.id) and not isnull(f2.id) . . . (as many as you like) you can generate the repeatance by some script hope this help -Leo-