mercwrought
Programmer
Hi all, Got a question. I have a table I am trying to group and the group needs to be groups of incremental dates. I know I have seen threads about this before but now I can not find them and I can not think of how to do this simply.
Let’s get some sample data:
desired output:
I know I can make a temp table and with that do some grouping but I was hoping for a better idea. Thx for any help … also I’m doing this because I have a really slow procedure that loops through it and I must speed it up. Once more thx for any help
Let’s get some sample data:
Code:
date amount
5/1/2005 10
5/2/2005 15
5/3/2005 4
5/5/2005 9
5/6/2005 55
5/10/2005 7
5/12/2005 99
desired output:
Code:
group from to amount
1 5/1/2005 5/3/2005 29
2 5/5/2005 5/6/2005 64
3 5/10/2005 5/10/2005 7
4 5/12/2005 5/12/2005 99
I know I can make a temp table and with that do some grouping but I was hoping for a better idea. Thx for any help … also I’m doing this because I have a really slow procedure that loops through it and I must speed it up. Once more thx for any help