gjsaturday
Technical User
but it's all I have to work with...
in this table
the fields correlate to days of the week...
tb1
id m t w th f
1 0 1 0 1 0
2 1 0 1 0 1
3 0 2 0 0 2
4 2 0 2 0 2
tb2
id date in out
1 03/21/2005 0 6
2 03/21/2005 10 5
3 03/21/2005 0 10
4 03/21/2005 30 2
1 03/22/2005 15 6
2 03/22/2005 0 3
3 03/22/2005 20 5
4 03/22/2005 0 8
1 03/23/2005 0 2
2 03/23/2005 12 2
3 03/23/2005 0 3
4 03/23/2005 50 4
1 03/24/2005 13 2
2 03/24/2005 0 2
3 03/24/2005 0 3
4 03/24/2005 0 4
1 03/25/2005 0 2
2 03/25/2005 12 2
3 03/25/2005 10 3
4 03/25/2005 50 4
I want a result set to look like the following...
id date in sum(out)
1 03/22/2005 15 8
1 03/24/2005 13 4
2 03/21/2005 10 8
2 03/23/2005 12 4
3 03/22/2005 20 11
3 03/25/2005 10 3
4 03/21/2005 30 10
4 03/23/2005 50 8
4 03/25/2005 50 4
I want to show the days where there is an "in" and the sum of the outs for that "in" day to the next "in" day, not including the next "in" day amounts.
I only have sql query analyzer to work with, nothing else.
Any help would be greatly appreciated.
Thanks in advance!
in this table
the fields correlate to days of the week...
tb1
id m t w th f
1 0 1 0 1 0
2 1 0 1 0 1
3 0 2 0 0 2
4 2 0 2 0 2
tb2
id date in out
1 03/21/2005 0 6
2 03/21/2005 10 5
3 03/21/2005 0 10
4 03/21/2005 30 2
1 03/22/2005 15 6
2 03/22/2005 0 3
3 03/22/2005 20 5
4 03/22/2005 0 8
1 03/23/2005 0 2
2 03/23/2005 12 2
3 03/23/2005 0 3
4 03/23/2005 50 4
1 03/24/2005 13 2
2 03/24/2005 0 2
3 03/24/2005 0 3
4 03/24/2005 0 4
1 03/25/2005 0 2
2 03/25/2005 12 2
3 03/25/2005 10 3
4 03/25/2005 50 4
I want a result set to look like the following...
id date in sum(out)
1 03/22/2005 15 8
1 03/24/2005 13 4
2 03/21/2005 10 8
2 03/23/2005 12 4
3 03/22/2005 20 11
3 03/25/2005 10 3
4 03/21/2005 30 10
4 03/23/2005 50 8
4 03/25/2005 50 4
I want to show the days where there is an "in" and the sum of the outs for that "in" day to the next "in" day, not including the next "in" day amounts.
I only have sql query analyzer to work with, nothing else.
Any help would be greatly appreciated.
Thanks in advance!