我应该如何播放此查询以按date_scheduled排序从最新到最早提前感谢。
$query = "(SELECT ref_num, event_type, time_scheduled, date_scheduled, date_apply as a, time_apply as t, m_lname as b, m_fname as c, f_fname as d, `read` as r, 'wedding' as type FROM wedding)
UNION
(SELECT ref_num, event_type, time_scheduled, date_scheduled, date_apply as a, time_apply as t, c_lname as b, c_fname as c, c_mname as d, `read` as r, 'baptism' as type FROM baptism)
ORDER BY date_scheduled DESC LIMIT 15
";
答案 0 :(得分:-1)
试试这个......
$query = "SELECT ref_num, event_type, time_scheduled, date_scheduled, a, t, b, c, d, r, type from (SELECT ref_num, event_type, time_scheduled, date_scheduled, date_apply as a, time_apply as t, m_lname as b, m_fname as c, f_fname as d, `read` as r, 'wedding' as type FROM wedding)
UNION
(SELECT ref_num, event_type, time_scheduled, date_scheduled, date_apply as a, time_apply as t, c_lname as b, c_fname as c, c_mname as d, `read` as r, 'baptism' as type FROM baptism) as tmp
ORDER BY date_scheduled DESC LIMIT 15
";