I have a survey table that shows the answers that people have taken once
a month when they enter a contest. I'm trying to find a better way to
have the sum of people who answer "Just Me ,My Spuse/Partner" and
another sum of people who people who answer Children, 0-5, 6-12,13-17
This is the table called "Survey" that is provided:
User JustMe Children 0-5 Children 6-12 Myspouse/partner
5 N N N N
5 N N N N
4 N N N N
4 N N N N
24 N N N N
24 N N N N
12 N N N N
12 Just Me N N Myspousepartner
46 Just Me N Children 6-12 years Mypousepartner
46 Just Me N Children 6-12 years Mypousepartner
Я просто надеюсь, что у меня будет такой стол
Я хочу, чтобы в моей таблице отображалась сумма детей в возрастной группе и Justme / Partner
I hope my output will be like this:
Children JustMe/Partner
4045 1200
* I tried this code:
SELECT
Children_13_17_years,Children_6_12_years,
TotalSubjects= Count(*) Over (partition by Children_13_17_years),
TotalSub= Count(*) Over (partition by Children_6_12_years)