At 07:45 PM 11/7/2003, Jonathan Terhorst wrote:
 <snip>
One way I have found to implement this is
SELECT Table1.id from Table1 JOIN Features USING(id) WHERE
Features.FeatureCode='A01' OR Features.FeatureCode='B02' GROUP BY Table1.id
HAVING COUNT(*)=2;

e.g. counting the duplications of id and selecting those equal to the number
of FeatureCodes I'm searching for. But this seems somehow inelegant, and I'm
justing wondering if there's a better way that's staring me in the face.

SELECT DISTINCT f.id FROM Table1 AS t, Features AS f WHERE f.id = t.id AND f.FeatureCode IN ('A01', 'B02');

HTH


mysql, query, sql




--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]



Reply via email to