>>>>select *,sum(jan_doll) as jan_money ,sum(feb_doll) as feb_money,;
>>>>from mysales;
>>>>order by part_number;
>>>>group by part_number;
>>>>into cursor mycursor....end of code...I am having a problem. The SUM is not right. Do I have to restart to SUM at the beginning of each group?
>>>
>...
>>Hi Nadya - working now...thanks....my imput data was wrong...:))
>
>It should work and glad working :) I only wanted to note 2 things Rob :
>1) select * (select all fields) is useless with aggregation functions unless you do it on purpose. Because you always get the last physically entered record for a group on other fields. ie:
>
>
PartName Date Amount
>part1 1/1/2000 130
>part1 1/1/1999 20
>...
>
>select *, sum(amount) as AmountTot from ..
>
>returns
>
>PartName Date Amount
>part1 1/1/1999 150
>
>no matter how you order.
>
>2) If group by expression is same as order by expression no need to 'order by' clause. SQL does an implicit order by on group by expression.
>Cetin
Hi Cetin:
Yes, I found that out how the GROUP BY works...thanks for letting me know about
ORDER BY clause......:)))