Re: Figuring out the ranking position of an item on a table given its partnumber

2004-08-25 Thread SGreen
You could simply run your query then use your programming language's facilities to scroll down the result set looking for the item in question. When you found the right record, you would know what it's ranking was based on how many rows of your results you had to scan through before you found i

Re: Figuring out the ranking position of an item on a table given its partnumber

2004-08-24 Thread Stephen E. Bacher
"C.F. Scheidecker Antunes" <[EMAIL PROTECTED]> wrote: >I have a table that has a PartNumber and the Quantity of Items sold for >each partNumber, that is: > >PartNumber >Qty > >I need to get its sales raking given its PartNumber, that is. So if I >order the table by Qyt in descending order the fi

Re: Figuring out the ranking position of an item on a table given its partnumber

2004-08-23 Thread Michael Stassen
You can use LIMIT. For the 123rd position: SELECT PartNumber, Qty FROM your table ORDER BY Qty DESC LIMIT 122, 1; With 2 arguments, LIMIT treats the first as the offset to the starting row (0 => first row, so 122 => position 123) and the second as the number of rows to show. This is doc