Get 7 days data from multiple tables in mysql.
从mysql中的多个表中获取7天的数据。
This is my select statement:
这是我的选择声明:
$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";
1 个解决方案
#1
0
You can try to use this:
您可以尝试使用此:
$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";
#1
0
You can try to use this:
您可以尝试使用此:
$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";