Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: "GROUP BY" question

Re: "GROUP BY" question

From: Remco Blaakmeer <remco_at_rd1936.quicknet.nl>
Date: 28 Mar 2000 18:46:26 GMT
Message-ID: <8bqum2$4ih$1@rd1936.quicknet.nl>


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

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US