List:General Discussion« Previous MessageNext Message »
From:Michael Dykman Date:November 22 2012 4:46pm
Subject:Re: Basic SELECT help
View as plain text  
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.
Thread
Basic SELECT helpNeil Tompkins22 Nov
  • Re: Basic SELECT helpMike OK22 Nov
  • Re: Basic SELECT helpmarek gutowski22 Nov
    • Re: Basic SELECT helpNeil Tompkins22 Nov
      • Re: Basic SELECT helpBenaya Paul22 Nov
        • Re: Basic SELECT helpNeil Tompkins22 Nov
  • RE: Basic SELECT helpJason Trebilcock22 Nov
    • Re: Basic SELECT helpMichael Dykman22 Nov
      • Re: Basic SELECT helpNeil Tompkins22 Nov
        • Re: Basic SELECT helpMichael Dykman22 Nov
      • Re: Basic SELECT helpNeil Tompkins22 Nov
      • Re: Basic SELECT helpNeil Tompkins22 Nov
      • Re: Basic SELECT helpNeil Tompkins22 Nov
  • Re: Basic SELECT helphsv22 Nov
Re: Basic SELECT helpMogens Melander22 Nov
Re: Basic SELECT helpMogens Melander22 Nov
  • Re: Basic SELECT helpMichael Dykman22 Nov
Re: Basic SELECT helphsv23 Nov
  • Re: Basic SELECT helpShawn Green19 Dec