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: Top Value

Re: Top Value

From: Richard Armstrong <StateOArt_at_worldnet.att.net>
Date: Wed, 2 Jun 1999 15:19:07 -0600
Message-ID: <7j46vg$77a$1@bgtnsc03.worldnet.att.net>


One way: (since you might want top counts that are equal)

create table temp001 as
select bill_seq_no, count(mobile_num) howmany from invoice
group by bill_seq_no;

select bill_seq_no, howmany
from temp001
where howmany =
(select max(howmany)
from temp001);

--



Richard Armstrong
State Of The Art Consulting, Inc.
http://www.stateoart.com

Mark Gumbs <mgumbs_at_nospam.hotmail.com> wrote in message news:3755204d.0_at_145.227.194.253...
> Hi,
>
> I have a statement
>
> SQL> select bill_seq_no, count(mobile_num)
> 2 from invoice
> 3 group by bill_seq_no;
>
> BILL_SEQ_N COUNT(MOBILE_NUM)
> ---------- -----------------
> MD0 14
> MD1 5
> MD2 1
>
> How can i rewrite the statement so it only returns the 1st line (MD0, 14)?
> Rownum won't help.
>
> M
>
>
Received on Wed Jun 02 1999 - 16:19:07 CDT

Original text of this message

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