Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: SQL Count/Max question
Something like this should work:
select * from
( select code, count(1) from LM group by date, code order by 2 desc);
"Daniel Lidstr m" <daniel.lidstrom@_DELETE_home.se> wrote in message news:<b2dq82$d7f$1_at_news.solace.mh.se>...
> Hello,
>
> I have the following result from a query, say LM:
>
> Date Code
> 2003-01-01 BL
> 2003-01-01 BL
> 2003-01-01 BL
> 2003-01-01 BL
> 2003-01-01 BL
> 2003-01-01 IM
> 2003-01-01 IM
> 2003-01-09 AA
> 2003-01-09 AA
>
> How do I find the Code which occurs the most times for a single date? In
> this case it is BL which occurs 5 times for a single date. It is possible
> that codes occur for more than one date, although there are none in this
> example. What I would like to see in the result is:
>
> Code Number
> BL 5
>
> How would I do this? Any hints/code samples greatly appreciated.
> Thanks!
Received on Wed Feb 12 2003 - 12:58:00 CST
![]() |
![]() |