Subject | Re: [ib-support] [OT ?] sql question |
---|---|
Author | Daniel Rail |
Post date | 2002-11-21T22:43:10Z |
At 21/11/2002 05:20 PM, you wrote:
order by 2
Where 2 refers to the second field in the result set, which in your case is
"sum(price*qty)".
Daniel Rail
Senior System Engineer
ACCRA Group Inc. (www.accra.ca)
ACCRA Med Software Inc. (www.accramed.ca)
> >>Try:
>select custID, sum(price*qty) from mv_li where op='PURCHASE' group by
>custID
> >>
>
>The final touch would be to get the list ordered by the purchase
>total, so that customers are ordered by their "weight".
>
>How do I do that ?
>
>I cannot add
>
>...order by sum(price*qty)
order by 2
Where 2 refers to the second field in the result set, which in your case is
"sum(price*qty)".
Daniel Rail
Senior System Engineer
ACCRA Group Inc. (www.accra.ca)
ACCRA Med Software Inc. (www.accramed.ca)