Try using either the LIMIT or the TOP clause..
 
The usage of TOP if I am not mistaken is
 
Select TOP n Column1, Column2,... from table_name order by Column[m] desc;
since you want to order your output in a descending order on the column that 
you choose..
 
The use of limit is something like
Select Column1, Column2.... from table_name LIMIT 10 order by Column[m] desc;
If this doesn't work try
Select Column1, Column2.... from table_name order by Column[m] desc LIMIT 10;
 
Hope this helps..
 
Joe


----- Original Message ----
From: Rick Cook <[EMAIL PROTECTED]>
To: [email protected]
Sent: Thursday, September 18, 2008 8:35:49 PM
Subject: Ranking rows in Oracle

** 
Looking for some help in debugging my syntax - Remedy says I'm missing a 
parameter, but not which one.
 
What I want to do is take a table with 100+ rows, and only return the 10 with 
the highest value in an integer field, ranked in descending order.
 
Here's the syntax that's failing:
 
SELECT Product_Categorization_Tier_1, Usage
(SELECT Product_Categorization_Tier_1, Usage dense_rank() over 
(ORDER BY Usage desc) 
FROM CIS_PCT_ProductCategoryUsage)
 WHERE ((Company = '$1000000001$') OR (Company = '- Global -'))
AND (Help_Desk_Selection = 0)
AND ((Assigned_Group = '$1000000217$') OR (Assigned_Group IS NULL)) 
AND (Status_PDA = 1)
 
I'd appreciate some help on this one.
 
Rick




_______________________________________________________________________________
UNSUBSCRIBE or access ARSlist Archives at www.arslist.org
Platinum Sponsor: www.rmsportal.com ARSlist: "Where the Answers Are"

Reply via email to