0

I need to find the total number of "wentto" trips for each month of the year . Assume all the months of 2010 are represented in the dataset.

1 Answer 1

1

You can use conditional aggregation:

select date_trunc('month', date) as tt,
       count(*) filter (where event = 'wentto')
from t
where date >= '2010-01-01' and date < '2011-01-01'
group by tt
order by tt;
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.