Board index » delphi » SQL Order by Sum(Amount)

SQL Order by Sum(Amount)

SELECT Supplier, Sum(Amount) AS SumOfAmount
FROM Table1
GROUP BY Supplier
ORDER BY Sum(Amount);

--
Brad Prendergast
http://www.bpsoftware.com/Delphi.htm

Quote
"Mike Weller" <M...@Newburn.com> wrote in message

news:3A09EFA6.7999612B@Newburn.com...
Quote
> I am producing a turnover report.

> Select Sum(Amount),Supplier  from PurchPay
> Group by Supplier
> Order by ???

> I can order by "Supplier" but, I really wish to list by "Sum(Amount)"
> descending
> Is this possible indirectly ?
>      -Mike Weller

 

Re:SQL Order by Sum(Amount)


Quote
>Select Sum(Amount),Supplier  from PurchPay
>Group by Supplier
>Order by ???

>I can order by "Supplier" but, I really wish to list by "Sum(Amount)"
>descending
>Is this possible indirectly ?

Select Sum(Amount),Supplier  from PurchPay
Group by Supplier
Order by 1   */ orders result by first field.

--
Brian Bushay (TeamB)
Bbus...@NMPLS.com

Re:SQL Order by Sum(Amount)


I am producing a turnover report.

Select Sum(Amount),Supplier  from PurchPay
Group by Supplier
Order by ???

I can order by "Supplier" but, I really wish to list by "Sum(Amount)"
descending
Is this possible indirectly ?
     -Mike Weller

Other Threads