Question : Mysql Query to retrieve data from last month range

HI,

I have the attached MySql Query, "post.dateline" is the date field. I want to add a WHERE clause to get only the records 40 days old or newer.

How to say?

Thanks
1:
2:
SELECT thread.dateline AS dateline_1, thread.threadid, thread.title, thread.lastpostid, thread.forumid, post.username, post.userid, post.dateline, thread.views, post.pagetext, thread.postusername, thread.replycount
FROM (thread LEFT JOIN post ON post.postid=thread.lastpostid)

Answer : Mysql Query to retrieve data from last month range

1:
2:
3:
4:
5:
SELECT thread.dateline AS dateline_1, thread.threadid, thread.title, thread.lastpostid, thread.forumid, post.username, post.userid, post.dateline, thread.views, post.pagetext, thread.postusername, thread.replycount
FROM (thread LEFT JOIN post ON post.postid=thread.lastpostid)
WHERE post.dateline >= UNIX_TIMESTAMP( DATE_SUB(NOW() , INTERVAL 40 DAY) )
  AND post.dateline <= UNIX_TIMESTAMP( DATE_ADD(NOW() , INTERVAL 40 DAY) )
Random Solutions  
 
programming4us programming4us