Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: a select within a count ??
avanrossem_at_hotmail.com (Andre) wrote in news:4d32d1be.0307010018.44650517
@posting.google.com:
> Hello all,
>
> I have a query, but it's not working.
>
> Can someone help me:
>
> select count(*), count(select distinct My_id from Anytable where My_id
> < 1000) from Anytable;
>
> In other words I want to execute a subquery within a count-statement.
> Is it possible ???
>
> Thx!,
> Andre
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;
Received on Tue Jul 01 2003 - 08:27:35 CDT
![]() |
![]() |