$sql =
(
SELECT new.new_podate AS order_date, new.new_top AS title, new.qq, new.new_add AS read_count, topname2.top2_name AS class_name, topname2.top_no, topname2.top2_no, guest_name AS author
FROM new, topname2
WHERE new.top_no = topname2.top_no
AND new.top2_no = topname2.top2_no
AND ( new.top_no=4 OR ( new.top_no=5 AND new.top2_no =1 ) OR ( new.top_no=8 AND new.top2_no =1 ) )
)
UNION ALL (
SELECT contant_date AS order_date, CONVERT(`detail`, CHAR) AS title, '' AS qq, '' AS read_count, '' AS class_name, top_no, top2_no, name AS author
FROM qanda
WHERE `top_no` =7 AND top2_no = 1
)
ORDER BY order_date DESC
LIMIT $start, 10
qanda的detail 是text 要轉換成char才能union
沒有留言:
張貼留言