เขียน sql order by 2 ชุด
Posted: 02/12/2014 6:53 pm
เขียน sql order by 2 ชุดเป็น array แล้ว buill ออกมามันไม่กระจายให้ขอคำแนะนำหน่อยคับ
output
SELECT t.topic_id FROM (phpbb_topics t) WHERE t.forum_id = 2 AND t.topic_type IN (0, 1) AND 1 = 1 ORDER BY Array
Code: Select all
$sql_ary = array(
'SELECT' => 't.topic_id',
'FROM' => array(
TOPICS_TABLE => 't',
),
'WHERE' => "$sql_where
AND t.topic_type IN (" . POST_NORMAL . ', ' . POST_STICKY . ")
$sql_approved
$sql_limit_time",
'ORDER_BY' => array('t.topic_type ' . ((!$store_reverse) ? 'DESC' : 'ASC') ,'t.topic_id ' . 'DESC' ,)
);
$sql = $db->sql_build_query('SELECT', $sql_ary);
print_r($sql);
SELECT t.topic_id FROM (phpbb_topics t) WHERE t.forum_id = 2 AND t.topic_type IN (0, 1) AND 1 = 1 ORDER BY Array