I am trying to learn SQL, but am having trouble with a relatively simple SELECT statement, as follows:
use northwind
select orderid, sum(quantity*unitprice-discount) as Monto
from [order details]
–order by (sum(quantity*unitprice-discount))
group by orderid
As it stands, the statement works; however, I want to order the listing in descending order by the calculated field. When I take out the comments indication, I get::
Server: Msg 156, Level 15, State 1, Line 9
Incorrect syntax near the keyword ‘group’.
Could you help me?