Jump to content

help with SQL select and php


nezbo

Recommended Posts

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.