Spójrz na to .
Zmień zapytanie na:
SET @rank=0;
SELECT @rank:[email protected]+1 AS rank, itemID, COUNT(*) as ordercount
FROM orders
GROUP BY itemID
ORDER BY ordercount DESC;
SELECT @rank;
Ostatni wybór to Twoja liczba.
Spójrz na to .
Zmień zapytanie na:
SET @rank=0;
SELECT @rank:[email protected]+1 AS rank, itemID, COUNT(*) as ordercount
FROM orders
GROUP BY itemID
ORDER BY ordercount DESC;
SELECT @rank;
Ostatni wybór to Twoja liczba.