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: Jerry Gitomer <jgitomer_at_erols.com>
Date: Sat, 26 Feb 2000 00:02:00 -0500
Message-ID: <38B75E48.C224ADDA@erols.com>


"Chen, Baoshan" wrote:
>
> 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'

Try:

	select category, count(*)
	from collection_data
	where category in ('A','B')
	group by category;

--
Jerry Gitomer
Once I learned how to spell DBA, I became one. Received on Fri Feb 25 2000 - 23:02:00 CST

Original text of this message

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