我试图选择多个表,其中endDate或startDate落在一个范围内。
SELECT *
FROM excel.construction
GROUP BY startDate,
endDate
UNION ALL
SELECT *
FROM excel.misc
GROUP BY startDate,
endDate
UNION ALL
SELECT *
FROM excel.spawar
GROUP BY startDate,
endDate
WHERE construction.startDate BETWEEN '2012-01-01' AND '2012-01-10'
OR construction.endDate BETWEEN '2012-01-01' AND '2012-01-10'
OR misc.startDate BETWEEN '2012-01-01' AND '2012-01-10'
OR misc.endDate BETWEEN '2012-01-01' AND '2012-01-10';
为什么这项工作没有/有更好的方法吗?
答案 0 :(得分:0)
一些事情
此3选择必须具有相同数量和类型的列
igAnalytics.php
where条件必须与正确的查询相关
SELECT * FROM excel.construction
SELECT * FROM excel.misc
SELECT * FROM excel.spawar