| Re: order by sum(amount) desc -
06-04-2007, 07:58 AM
PeterD <EMAIL REMOVED> wrote:
> I have a table of transactions, with a Who field. I want a list of all
> the distinct Who values, a total of their transactions, starting from
> the biggest total.
>
> Why doesn't this work?
>
> select who, sum(amount)
> from transactions
> group by who
> order by sum(amount) desc
Oops, never mind. This works:
select who, sum(amount) Total
from transactions
group by who
order by Total desc
--
Pd |