PDA

View Full Version : sql query to show all not active forums?


admolot
09-29-2007, 05:21 PM
Hi,

I would like to know which mySQL query I have to run to see all forums which have 0 posts for 1 month...

Any help would be appreciated.

Eikinskjaldi
10-01-2007, 08:00 AM
forums have a lastpost field which stores the dateline of the last post.

You thus need to grab the lastpost and check it against some measure of "month"

one possibility:

select forumid from forum where to_days(now()) - to_days(from_unixtime(lastpost)) > 30

admolot
10-06-2007, 07:38 PM
thanks, it works...

is there any way I can exclude some of the forums from search?

Michael Biddle
10-06-2007, 08:02 PM
where forumid != x

Kirk Y
10-06-2007, 08:29 PM
It'd be AND in this particular case, as there's already a WHERE statement.