"Pivot operator"
onyourmark
Member, University ProfessorPosts:10University Professor
Hello. We are trying to use the pivot operator.
We want to collapse the rows that have the same date with summing of the values of the variables.
So that a table like this
Date Variable1 Variable2 Variable3 Variable4
2012/04/20 5 2 2 6
2012/04/20 6 5 2 6
2012/04/20 5 8 6 2
2012/04/21 5 7 2 2
2012/04/21 8 6 2 6
2012/04/22 8 4 8 9
2012/04/22 5 5 5 8
Would become this:
Row Labels Sum of Variable1 Sum of Variable2 Sum of Variable3 Sum of Variable4
4/20/2012 16 15 10 14
4/21/2012 13 13 4 8
4/22/2012 13 9 13 17
Grand Total 42 37 27 39
Can anyone suggest what to do to get this?
Thanks!
We want to collapse the rows that have the same date with summing of the values of the variables.
So that a table like this
Date Variable1 Variable2 Variable3 Variable4
2012/04/20 5 2 2 6
2012/04/20 6 5 2 6
2012/04/20 5 8 6 2
2012/04/21 5 7 2 2
2012/04/21 8 6 2 6
2012/04/22 8 4 8 9
2012/04/22 5 5 5 8
Would become this:
Row Labels Sum of Variable1 Sum of Variable2 Sum of Variable3 Sum of Variable4
4/20/2012 16 15 10 14
4/21/2012 13 13 4 8
4/22/2012 13 9 13 17
Grand Total 42 37 27 39
Can anyone suggest what to do to get this?
Thanks!
Tagged:
0
Answers
You need to use the aggregate operator
Here's an example regards
Andrew