Prøv dette:
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
Prøv dette:
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