SELECT a.paid, a.total, a.remain, a.date, a.patient_id FROM (
(SELECT paid, total, remain, date, patient_id FROM payment )
UNION
(SELECT paid, total_need AS total, remain, date, patient_id FROM patient_vouchers )
) a
WHERE a.patient_id ='.$patient_id.'
ORDER BY a.date ASC
I need to get records from two different tables order by date, so what is wrong in this sql statement to get me that error?!
查找具有不同排序规则的变量并对齐它们,例如使用COLLATE utf8_general_ci
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.