Ok, I'm making a forum for my site, and in order to count all stats, how many posts each thread has etc, I use a query like:
Code: Select all
SELECT F.*, COUNT(P.`ID`) AS `PostCount`, P.`Subject` AS `LastPost` /*<- not working!*/
FROM `Forum` F
INNER JOIN `Forum` P ON P.`Thread`=F.`ID`
WHERE F.`Type`='thread'
GROUP BY F.`ID`
ORDER BY `ID` DESCIf the join was ordered by `ID` DESC then the last post would be in `LastPost`, however, I can't figure out how to order the join, or if that's even possible. I've searched all over google...
Any help would be much appreciated
Thanks,
Jack.