Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: SQL query!

Re: SQL query!

From: dombrooks <dombrooks_at_hotmail.com>
Date: 17 Jan 2007 03:18:38 -0800
Message-ID: <1169032718.813013.249260@38g2000cwa.googlegroups.com>


 create table test
 (cola number
,colb number
,colc varchar2(2));

 insert all

 into test values (1,10,'S1')
 into test values (1,10,'S2')
 into test values (2,20,'S3')
 into test values (2,30,'S4')
 into test values (3,40,'S5')
 into test values (4,50,NULL)

 select * from dual

 SELECT *
 FROM test

 select cola
 from test
 where colc is not null
 group by cola
 having count(distinct colb) > 1

 or

 select *
 from (select t.*

        ,      count(distinct colb) over (partition by cola) c
        from   test t
		where  colc is not null)

 where c > 1 Received on Wed Jan 17 2007 - 05:18:38 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US