Home » SQL & PL/SQL » SQL & PL/SQL » DISTINCT ROWNUM (Oracle 10g)
DISTINCT ROWNUM [message #339815] Fri, 08 August 2008 13:23 Go to next message
aokwuadigb
Messages: 18
Registered: August 2008
Junior Member
I am trying to SELECT the top ten rows with DISTINCT cost from the following query.

I have tried DISTINCT ronum<11 but it doesnt work. Any suggestions?

SELECT   l.Location_Id Location,
         SUM(cos.Information_Id) COST
FROM     (SELECT   t.Target_Id Target_Id,
                   t.Location_Id Location_Id,
                   COUNT(i.Information_Id) Information_Id
          FROM     Targets t
                   RIGHT OUTER JOIN Information i
                     ON t.Target_Id = i.Target_Id
          GROUP BY t.Target_Id,
                   t.Location_Id) cos
         RIGHT OUTER JOIN Locations l
           ON cos.Location_Id = l.Location_Id
GROUP BY l.Location_Id
ORDER BY SUM(cos.Information_Id) DESC


Re: DISTINCT ROWNUM [message #339816 is a reply to message #339815] Fri, 08 August 2008 13:26 Go to previous messageGo to next message
BlackSwan
Messages: 25039
Registered: January 2009
Location: SoCal
Senior Member
http://www.orafaq.com/forum/t/88153/0/
Please read & follow posting guidelines as stated in URL above

> Any suggestions?
Learn how to use the SEARCH function on this forum!
Re: DISTINCT ROWNUM [message #339827 is a reply to message #339815] Fri, 08 August 2008 15:10 Go to previous messageGo to next message
S.Rajaram
Messages: 1027
Registered: October 2006
Location: United Kingdom
Senior Member
Just for the information.

http://forums.oracle.com/forums/thread.jspa?threadID=692641&tstart=0

Regards

Raj
Re: DISTINCT ROWNUM [message #339829 is a reply to message #339815] Fri, 08 August 2008 15:17 Go to previous message
BlackSwan
Messages: 25039
Registered: January 2009
Location: SoCal
Senior Member
You can lead some folks to knowledge, but you can't make them think.
Previous Topic: 4 Week rolling average.. is this possible?
Next Topic: Hi - need help with if statement
Goto Forum:
  


Current Time: Tue Dec 06 02:37:36 CST 2016

Total time taken to generate the page: 0.15664 seconds