RE: SQL for top 100 values

2002-01-10 Thread Toepke, Kevin M
nal Message- Sent: Thursday, January 10, 2002 1:23 PM To: Multiple recipients of list ORACLE-L Don't use any aliases (x in your case) and try again Regards -Original Message- Sent: Thursday, January 10, 2002 12:32 PM To: Multiple recipients of list ORACLE-L Subject: RE:

RE: SQL for top 100 values

2002-01-10 Thread Babich , Sergey
You may be right, that's the version issue -Original Message- Sent: Thursday, January 10, 2002 12:32 PM To: Multiple recipients of list ORACLE-L Subject: RE: SQL for top 100 values I tried to run it in Oracle 7.3.4, it comes up with a syntax error Here is th

Re: SQL for top 100 values

2002-01-10 Thread orantdba
This was a new feature in Oracle8i. In 7.3 the best way would be to open a cursor that sorted the data and return the first N rows. Sorry, John [EMAIL PROTECTED] wrote: I tried to run it in Oracle 7.3.4, it comes up with a syntax errorHere is the SQLselect x.fein,x.open_balfrom (sel

Re: SQL for top 100 values

2002-01-10 Thread Stephane Faroult
Deen Dayal wrote: > > I tried to run it in Oracle 7.3.4, it comes up with a syntax error > > Here is the SQL > select x.fein,x.open_bal > from (select sf_get_fein(employer_id) fein, nvl(total_open_balance_amt,0) >open_bal > from employer > order by open_bal desc ) x

RE: SQL for top 100 values

2002-01-10 Thread Babich , Sergey
Don't use any aliases (x in your case) and try again Regards -Original Message- Sent: Thursday, January 10, 2002 12:32 PM To: Multiple recipients of list ORACLE-L Subject: RE: SQL for top 100 values I tried to run it in Oracle 7.3.4, it comes up with a syntax error

RE: SQL for top 100 values

2002-01-10 Thread Babich , Sergey
Correction : SELECT * FROM (SELECT DISTINCT VALUES FROM TABLE ORDER BY VALUES DESC) WHERE ROWNUM < 101; -Original Message- Sent: Thursday, January 10, 2002 11:51 AM To: Multiple recipients of list ORACLE-L Subject: Re: SQL for top 100 values SELECT * FROM (SELECT VAL

RE: SQL for top 100 values

2002-01-10 Thread Deen Dayal
I tried to run it in Oracle 7.3.4, it comes up with a syntax error Here is the SQL select x.fein,x.open_bal from (select sf_get_fein(employer_id) fein, nvl(total_open_balance_amt,0) open_bal from employer order by open_bal desc ) x where rownum < 101 Here is what

Re: SQL for top 100 values

2002-01-10 Thread tday6
SELECT * FROM (SELECT VALUES FROM TABLE ORDER BY VALUES) ROWNUM < 101; Deen Dayal

RE: SQL for top 100 values

2002-01-10 Thread Mohan, Ross
Or use KdB. -Original Message- Sent: Thursday, January 10, 2002 11:26 AM To: Multiple recipients of list ORACLE-L If using 8i SELECT * FROM (SELECT * FROM ORDER BY DESC) WHERE rownum <= 100; Rick "Deen Dayal" <[EMAIL PR

Re: SQL for top 100 values

2002-01-10 Thread Jan Pruner
Use ORDER BY DESC and, of course, rownum < 101 :-))) -- SELECT NAME, VALUE FROM ( SELECT NAME, VALUE FROM TOP100 ORDER BY VALUE DESC ) WHERE ROWNUM < 101 JP On Thu 10. January 2002 17:03, you wrote: > hi SQL wizards, > > Can any body help me with the tjis SQL. I need a SQL rec

Re: SQL for top 100 values

2002-01-10 Thread Ron Rogers
Deen,  You could try SELECT fields... FROM (SELECT field1 FROM table1 ORDER BY field1) WHERE rownum > 100;  ( the value is 100 less that number of rows returned) That will order the rows returned by the value in the field1 and then give you the row numbers of the returned rows that are greate

Re: SQL for top 100 values

2002-01-10 Thread Marin Dimitrov
- Original Message - To: "Multiple recipients of list ORACLE-L" <[EMAIL PROTECTED]> Sent: Thursday, January 10, 2002 18:03 > hi SQL wizards, > > Can any body help me with the tjis SQL. I need a SQL records with top 100 values of a table ( not rownum < 101 ). u do need rownum select * f

Re: SQL for top 100 values

2002-01-10 Thread Stephane Faroult
Deen Dayal wrote: > > hi SQL wizards, > > Can any body help me with the tjis SQL. I need a SQL records with top 100 values of >a table ( not rownum < 101 ). > > Thanks > Deen > rownum < 101 is OK if you nest your query, ORDER BY included, as an in-line view, ie select x.val from (se

Re: SQL for top 100 values

2002-01-10 Thread Rick_Cale
If using 8i SELECT * FROM (SELECT * FROM ORDER BY DESC) WHERE rownum <= 100; Rick "Deen Dayal"