Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: group by problem!!!
In article <3B7CD7B9.20CBCE8A_at_ratp.fr>, gil says...
>
>i'd like to obtain on the same line of my sql select query:
>
>select sector,count(event) closed,count(event) all_events
>from table
>group by sector
>
>but all_events is for all events of course (no where clause on the
>status) and closed is only for events with status 'C'
>
>i did it with a union select but i obtain 2 lines...
>
>how can i do ???
>
>thanks
>
>
select sector,
sum( decode( status, 'C', 1, '0 ) ) closed, count(event) all_events
-- Thomas Kyte (tkyte@us.oracle.com) http://asktom.oracle.com/ Expert one on one Oracle, programming techniques and solutions for Oracle. http://www.amazon.com/exec/obidos/ASIN/1861004826/ Opinions are mine and do not necessarily reflect those of Oracle CorpReceived on Fri Aug 17 2001 - 10:27:14 CDT
![]() |
![]() |