Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: SQL query!
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 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)
![]() |
![]() |