PDA

View Full Version : Last thread


filburt1
12-12-2002, 08:04 PM
What query returns the forumid,threadid,and title for the most recent thread in each forum?

1. Yes, I looked at the code for TECK's hack
2. Yes, I tried this:

SELECT t.title AS title, t.threadid AS threadid, f.forumid AS forumid
FROM thread t, forum f
WHERE t.forumid = f.forumid
GROUP BY f.forumid
ORDER BY dateline DESC

(it always returned the oldest one, not the most recent one)

NTLDR
12-12-2002, 08:16 PM
Use ASC not DESC, seems to work for me :)

filburt1
12-12-2002, 08:18 PM
Nope, still returns the first one.

nuno
12-12-2002, 09:00 PM
Try

SELECT forum.*, thread.title as thtitle FROM forum
LEFT OUTER JOIN thread on thread.forumid = forum.forumid and thread.lastpost >=
(forum.lastpost-30)
WHERE displayorder<>0 AND active=1
ORDER BY parentid,displayorder

filburt1
12-12-2002, 09:01 PM
That's TECK's

...but thanks, after changing his query a bit I got it to work.

nuno
12-12-2002, 09:06 PM
Originally posted by filburt1
That's TECK's

No, it isn't ;)