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: SQL Count/Max question

Re: SQL Count/Max question

From: Jusung Yang <JusungYang_at_yahoo.com>
Date: 12 Feb 2003 10:58:00 -0800
Message-ID: <130ba93a.0302121058.3ced439a@posting.google.com>


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

Original text of this message

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