Forum Moderators: open
tblPosts
ID ¦ TopicParent ¦ PosterID ¦ PostDate ¦ PostTitle ¦ PostBody
1 ¦ 1 ¦ 9 ¦ 041407 ¦ Blah1 ¦ blah1
2 ¦ 1 ¦ 10 ¦ 041507 ¦ ¦ blah2
3 ¦ 1 ¦ 11 ¦ 041607 ¦ ¦ blah3
4 ¦ 4 ¦ 15 ¦ 041807 ¦ Blah4 ¦ blah4
5 ¦ 4 ¦ 16 ¦ 041907 ¦ ¦ blah5
6 ¦ 4 ¦ 17 ¦ 042007 ¦ ¦ blah6
I'd like to use a single statement to SELECT the *original* post (id=1) but also grab the date of the latest post (id=3) so that I can ORDER BY PostDate DESC; but nothing I can think of offhand works, and I've been trying various solutions for days to no avail. IS there a way to do this? From what I've read mySQL is extremely robust, and leads me to believe there is a simple but elusive answer.
Basically I want to turn my SELECT * FROM tblPosts WHERE ID = TopicParent (which selects all the initial posts) and still have something in that recordset that I can pull the latest reply to that initial post, for the following result(as it'd look on the web page}:
Title PosterID LastPost
Blah4 4 042007
Blah1 1 041607
(excuse the bad ascii table layout. You'd think some forums other than mine would get the pre tag straight. And the dates are 'fake' to conserve space)
Thanks in advance,
Lyc
[edited by: Lycaon at 9:15 am (utc) on April 20, 2007]