Re: Finding top x percent of data On Dec 5, 3:22 pm, Sanjuro <ashru...@gmail.com> wrote:
> Could you give us a solution in other RDBMS that does successfully
> what you want to achieve?
>
> Cheers,
> Sanjuro
>
> On Dec 5, 2:18 pm, nyc...@yahoo.com wrote:
>
> > I am trying to do the following w/ SQL for db2 9...
> > I want to find the top x percent of rows. For example, if i wanted to
> > find the average sale price of the top 10 most expensive items in a
> > store, how could I go about doing that, w/o a stored procedure? I've
> > been searching, and have come across many solutions for other RDBMS,
> > but not yet for DB2.
>
> > Thanks in advance.
It looks like SQL server can do something like this:
SELECT TOP 10 PERCENT
OrderID, CustomerID, EmployeeID, OrderDate
FROM dbo.Orders
WHERE EmployeeID = 5
ORDER BY OrderDate |