From: Michael Dykman Date: November 22 2012 4:46pm Subject: Re: Basic SELECT help List-Archive: http://lists.mysql.com/mysql/228696 Message-Id: MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Assuming that (id,type) is unique in the source data, that is a pretty elegant method: > select id from > (select distinct id, count(*) > from my_table > where type in (2,5) > group by id > having count(*) = 2)a; > -- - michael dykman - mdykman@stripped May the Source be with you.