
Untitled
By: a guest on
May 9th, 2012 | syntax:
None | size: 0.56 KB | hits: 25 | expires: Never
SELECT *, t.state+0 as state_num, t.id as topic_id from forumTopics t
LEFT JOIN forumUsers u on t.creator=u.id
LEFT JOIN forumReplies r ON r.posted=(SELECT posted FROM forumReplies WHERE topicID=t.id ORDER BY posted DESC LIMIT 1)
WHERE t.sectionID=?
ORDER BY COALESCE(%s, %s) DESC LIMIT %d, %d
Accessed by:
public function getTopics($section, $start, $end, $by_created=false) {
$s = ($by_created == true ? 't.created' : 'r.posted');
return parent::query(sprintf($this->queries['getTopicsEx'], $s, 't.created', $start, $end), array(&$section));
}