Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SELECT Based on Max() value 1

Status
Not open for further replies.

tekdudedude

Technical User
Sep 29, 2007
79
0
0
Hello,

In an Oracle 10g database I have the below SQL which works:
Code:
SELECT sid,recid,stamp,output
FROM v$rman_output
WHERE recid > 17400
ORDER BY recid;

Functionally I need to run this:
Code:
SELECT sid,recid,stamp,output
FROM v$rman_output
WHERE recid > max(rownum)-25
ORDER BY recid;

But I get the error:

WHERE recid > max(rownum)-25
*
ERROR at line 3:
ORA-00934: group function is not allowed here


What can you recommend please?

Thanks,

TD
 
Code:
SELECT sid
     , recid
     , stamp
     , output
  FROM v$rman_output AS T
 WHERE ( select count(*)
           from games
          where score < T.score ) < 25
ORDER 
    BY recid;

r937.com | rudy.ca
 
r937,

Thanks for posting - that did the trick. :)

TD
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top