Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: "GROUP BY" question
"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
![]() |
![]() |