PDA

View Full Version : Getting all POSTS in a particular forum.


Axe
Sat 11th Jan '03, 10:27pm
Ok, I know I can do...

select * from thread where forumid="40";

to select all threads in forum number "40". But, how can I retrieve all POSTS that reside in forum number "40" in a single query?

Also, how can I limit this query to threads that were started in the past 30 days?

Axe
Sun 12th Jan '03, 12:16am
Okies, I figured out the first bit...select post.threadid, post.postid, post.title, post.dateline as postdate, thread.dateline as threaddate from post, thread where post.threadid=thread.threadid && thread.forumid="40" order by threaddate desc, postdate asc;Which gives me all the posts in a particular forum area.The results are first sorted by the date of the thread (most recent first), then by the date of the posts (oldest first).Now, how can I limit this to threads that were started within the last 30 days? (bear in mind, that there could be a post in the last 30 days which is on a 2 year old thread, and I don't want that to show).