Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: "GROUP BY" question
In article <74471DFD03A7D11191E000600852EC6F05A9BC8E_at_dallas>,
"Chen, Baoshan" <Baoshan.Chen_at_garmin.com> writes:
> Sorry for the simple question. How can I get the forth line (A or B)
> using SQL statements?
>
> category count
> A 5
> B 10
> A or B 15
>
> The following statement seems not to work.
>
> select category count(*) from collection_data
> group by category
> having category = 'A' or category = 'B'
select category
, count(*) count
from collection_data
group by category
union all
select 'ALL' category
, count(*) count
from collection_data
Remco
--
rd1936: 8:40pm up 8 days, 2:00, 12 users, load average: 1.45, 1.56, 1.66
Received on Tue Mar 28 2000 - 12:46:26 CST
![]() |
![]() |