I have the following two tables:
Posts
- post_id
- post_title
- post_timestamp
Comments
- comment_id
- posts_post_id
- comment_content
- comment_timestamp
I want to create a report that shows the weekly post count and comment count. Something like this:
Week StartDate Posts Comments
1 1/1/2012 100 305
2 1/8/2012 115 412
I have this query but it only pulls form the Posts table.
select makedate( left(yearweek(p.post_timestamp),1),week(p.post_timestamp, 2 ) * 7 ) as Week, COUNT(p.post_id) as Posts
FROM cl_posts p
GROUP BY Week
ORDER BY WEEK(p.post_timestamp)
How do I add the Comment count too?
I think you need something like this: