Can I run a select statement and get the row number if the items are sorted?
I have a table like this:
mysql> describe orders; +-------------+----
SELECT @rn:=@rn+1 AS rank, itemID, ordercount FROM ( SELECT itemID, COUNT(*) AS ordercount FROM orders GROUP BY itemID ORDER BY ordercount DESC ) t1, (SELECT @rn:=0) t2;