我的是这样
$query = $db->query("SELECT $dotadd1 t.*, p.rate FROM $table_threads t $dotadd2
LEFT JOIN $table_posts p USING(tid, dateline)
WHERE (t.displayorder='3' OR t.fid='$fid' AND t.displayorder>='0' ) $filteradd $cateidadd
ORDER BY t.displayorder DESC, t.lastpost $ascdesc
LIMIT $start_limit, $tpp ");