nezbo Posted January 29, 2010 Share Posted January 29, 2010 Hi all I am tring to sort the content of my forum by the post comments... i.e. i am trying to sort the form by most recent comment... this is my SQL i have so far $result = @mysql_query("SELECT forumID, forumHedder, forumBoddy, dateStamp, userID, email, valid , IF((SELECT TOP 1 timeStamp FROM forum_replies WHERE forum.forumID = forumID ORDER BY timeStamp DESE) = 0, forum.dateStamp, timeStamp) FROM forum WHERE valid=0 ORDER BY dateStamp DESC LIMIT " . $pages . " , 30"); I want to order be the timeStamp FROM forum_replies but not all posts have been responded to so it will need to be check against the main post date forum.dateStamp... Hope this make sence? Link to comment https://forums.phpfreaks.com/topic/190243-help-with-sql-select-and-php/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.