I have a table with the following columns
member_number
step_count
social_activity -- (which contains both Challenges and Posts)
high_fives
Basically all the columns 2-4 are counts for members.
I want to create a report where I can display member_number
, step_count
, social_activity
(where it is 'challenges'), social_activity
(where it is 'posts') and high_fives
.
I wrote the query
select member_number, step_count, social_activity
from ABC
group by member_number
But I want the query to get the separate count for social_activity
('challenges') and social_activity ('posts').
Can some one help me with this?
Best Answer
Seems like you need a conditional sum based on CASE: