Something like this might help... This should give you the 3 highest values
for "Val".
SELECT *
FROM my_table a
WHERE 3 >=
(SELECT COUNT(DISTINCT Val)
FROM my_table b
WHERE b.Val >= a.Val)
ORDER BY Val DESC;
-----Message d'origine-----
De : Kumar, Sumit [mailto:[Email Address Removed] : 30 août, 2002 11:31
À : LazyDBA.com Discussion
Objet : Please help in building SQL
I am having one table like
Type Val
---- -----
Res 78.90
Res 65.78
Res 76.98
Utr 67.87
Utr 98.75
Yre 78.87
Yer 88.56
I have to find out top 3 values of each type please help me to build SQL for
it I am working with 8.1.7.
Thanks in Advance.
Regards,
Sumit Kumar
This e-mail and any attachment is for authorised use by the intended
recipient(s) only. It may contain proprietary material, confidential
information and/or be subject to legal privilege. It should not be copied,
disclosed to, retained or used by, any other party. If you are not an
intended recipient then please promptly delete this e-mail and any
attachment and all copies and inform the sender. Thank you.
--------
Oracle documentation is here:
http://tahiti.oracle.com/pls/tahiti/tahiti.homepage
To unsubscribe: send a blank email to oracledba-[Email Address Removed] subscribe: send a blank email to oracledba-[Email Address Removed] the list archive: http://www.LAZYDBA.com/odbareadmail.pl
Tell yer mates about http://www.farAwayJobs.com
By using this list you agree to these
terms:http://www.lazydba.com/legal.html
Oracle LazyDBA home page