summarize data
Hi,
I have a table that contains the following fields
StudentId , NoOfChildren, Over18 stat
1 2 null 0
2 1 1 -1
3 2 0 0
4 3 1 0
studentid is an identity field.
What I need to do is calculate the number of children per household
(NoOfChildren -over18)+stat
and put them into columns such as the following:
1-3 4-5
1 3
If in the table there is only one family with 1-3 household members it goes under 1-3, if there are 3 families with 4-5 household members it will go under column 4-5.
also if stat=0 then i need to add by 2 else add by one.
How can I accomplish that?
Thanks
|