Take the tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

Extremely new to postgres so I apologize..

The person before me set up data clips in heroku pulling our new active users per day. I need to pull the cumulative active users, active users in the last 14 days, MTD for this month, and then same range for last month..using what I would assume is the same query as a basis? Here's the working one. Any idea how to change the date ranges to pull what I need? These didnt seem to help me: http://www.postgresql.org/docs/9.1/static/functions-datetime.html , http://www.postgresql.org/docs/9.1/static/datatype-datetime.html

select first_d, count(sid) from (select school_id sid, min(date_trunc('days',created_at)) first_d from point_entries where activity_type is not null group by sid order by sid desc) t1 where first_d > (date_trunc('days',now())- interval '10 days' ) group by first_d order by first_d desc;

share|improve this question
add comment

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.