Log in

View Full Version : Count posts from a specific date


navjotjsingh
10-04-2006, 01:08 AM
How to count posts of a user within a specific date range say 3rd September 2006 to 3rd October 2006?

I tried running this SQL Query but it didn't work for me:


SELECT COUNT(post.postid) AS count, user.username
FROM post
LEFT JOIN user ON (user.userid = post.userid)
WHERE post.userid = 1
AND (UNIX_TIMESTAMP('2004-04-02 00:00:00')) <= post.dateline
AND post.dateline <= (UNIX_TIMESTAMP('2004-05-04 00:00:00'))

GROUP BY post.userid


It returned this error:

An error occurred while attempting to execute your query. The following information was returned.
error number: 1146
error desc: Table 'exguides_careervb.post' doesn't exist

navjotjsingh
10-05-2006, 03:37 AM
Ok Got it..Now...Correct Query is now:


SELECT COUNT(post.dateline) AS postcount, post.userid, user.username
FROM vb_post AS post
LEFT JOIN vb_user AS user ON (user.userid = post.userid)
WHERE (UNIX_TIMESTAMP('2006-09-03 00:00:00')) <= post.dateline
AND post.dateline <= (UNIX_TIMESTAMP('2006-10-03 00:00:00'))

GROUP BY userid ORDER BY postcount DESC