>>Ko,
>>
>>Your result is not what I want:
>>
>>Sample:
>>1999 01 20
>>1999 01 30
>>1999 03 40
>>2000 01 10
>>2000 01 15
>>2000 02 20
>>2000 03 10
>>
>>Result should be:
>>1999 01 50 2
>>1999 03 90 3
>>2000 01 25 2
>>2000 02 45 3
>>2000 03 55 4
>>
>>
>>See the difference with your result?
>
>Sorry,
>
>After looking again at my post i see that you added a comment to my post in the post itself.
>Now i see the problem.
>Just a simple typo.
>For Table2 in the line of 02 2000 the amount should be 22 instead of 20.
>
>Sorry again for misleading you,
>
>But the code itself gave the wanted result.
Thanks, Ko. Yes, a simple typo led to a problem :)
BTW, the problem turns to be a little bit more complicated.
Suppose, I select records from our database for this period of time:
06/01/1997 to 11/30/2000
I'd like to have data on each possible period: each month, each quoter, each year in this time frame. How can I create a table with all these periods (I can not garantee, that all these periods would be in selected result).
If it's not broken, fix it until it is.
My Blog