Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: a select within a count ??
Chuck <chuckh_at_softhome.net> wrote in
news:Xns93AB60377BC40chuckhsofthomenet_at_130.133.1.4:
> avanrossem_at_hotmail.com (Andre) wrote in news:4d32d1be.0307010018.44650517
> @posting.google.com: >
> > Looks like you are trying to get a total record count, and a count of > only those where my_id < 1000. Try this... > > select > count(*) > , sum(case when my_id < 1000 then 1 else 0 end) > from > anytable; > >
Ooops, I missed the distinct. Change that select to this...
select
a.cnt, b.cnt
from
(select count(*) cnt from anytable) a,
(select count(distinct my_id) cnt from anytable where my_id < 1000) b
Received on Tue Jul 01 2003 - 08:33:27 CDT
![]() |
![]() |