gpt4 book ai didi

mysql - 如何从多个表中获取7天的数据

转载 作者:行者123 更新时间:2023-11-30 22:19:04 25 4
gpt4 key购买 nike

从 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";

最佳答案

你可以尝试使用这个:

$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";

关于mysql - 如何从多个表中获取7天的数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37250830/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com