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; +-------------+----
It's now builtin in MySQL 8.0 and MariaDB 10.2:
SELECT itemID, COUNT(*) as ordercount, ROW_NUMBER OVER (PARTITION BY itemID ORDER BY rank DESC) as rank FROM orders GROUP BY itemID ORDER BY rank DESC