Опитайте това:
SET @counter = 0;
Select sub.*
FROM
(
select orderid, (@counter := @counter +1) as counter,
round(sum(unitprice * quantity),2) as value
from order_details
group by orderid
) sub
order by 2 desc
Опитайте това:
SET @counter = 0;
Select sub.*
FROM
(
select orderid, (@counter := @counter +1) as counter,
round(sum(unitprice * quantity),2) as value
from order_details
group by orderid
) sub
order by 2 desc