Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: QUERY HELP NEEDED

Re: QUERY HELP NEEDED

From: Michel Cadot <micadot{at}altern{dot}org>
Date: Sat, 10 Mar 2007 16:19:51 +0100
Message-ID: <45f2cc95$0$28917$426a74cc@news.free.fr>

<fwdkhan_at_gmail.com> a écrit dans le message de news: 1173535488.859876.105360_at_j27g2000cwj.googlegroups.com...
| Hi All,
| i need ur help this is the query i have written now what i want is the
| maximum value from EXPR1 column i try to use use MAX(Count(COL1)) but
| it give error pls help me to achieve this task. i hope u understand my
| question. thanku.
|
|
| SELECT COUNT(TABLE1.COL1) AS Expr1, TABLE2.COL2
| FROM TABLE1,TABLE2 where TABLE1.COL1 = TABLE2.COL1
| GROUP BY TABLE2.COL2
| ORDER BY expr1 DESC
|
|
|
| RESULT
|
| EXPR1 COL2
| 6 1212131
| 6 1212131
| 4 121121
| 2 1212121
|
|
| what i want is the maximum values
|
| RESULT
| EXPR1 COL2
| 6 1212131
| 6 1212131
|

select * from (
SELECT COUNT(TABLE1.COL1) AS Expr1, TABLE2.COL2 FROM TABLE1,TABLE2 where TABLE1.COL1 = TABLE2.COL1 GROUP BY TABLE2.COL2
ORDER BY expr1 DESC
) where rownum = 1

Regards
Michel Cadot Received on Sat Mar 10 2007 - 09:19:51 CST

Original text of this message

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