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 documented in the manual <http://dev.mysql.com/doc/mysql/en/SELECT.html>.
Michael
C.F. Scheidecker Antunes wrote:
Hello All,
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 Qty in descending order the first
record will be the partNumber that sold the most. If I want to know what is 123 ranking position according to that.
Is there any easy way to do it?
Thanks in advance.
-- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]