从mysql中的多个表中获取7天的数据。
这是我的选择陈述:
$sql="SELECT * FROM chain_management UNION
SELECT * FROM adagio_accounting_suite UNION
SELECT * FROM billquick UNION
SELECT * FROM budgetingdb UNION
SELECT * FROM chain_management UNION
SELECT * FROM accountpayable
WHERE DATE >= DATE_SUB(CURDATE(), INTERVAL 7 DAY) ORDER BY curtime DESC";
答案 0 :(得分:0)
你可以尝试使用它:
$sql="SELECT * FROM (SELECT * FROM chain_management UNION
SELECT * FROM adagio_accounting_suite UNION
SELECT * FROM billquick UNION
SELECT * FROM budgetingdb UNION
SELECT * FROM chain_management UNION
SELECT * FROM accountpayable) as XYZ
WHERE DATE >= DATE_SUB(CURDATE(), INTERVAL 7 DAY) ORDER BY curtime DESC";