我正在使用 SQL Server 2008 R2。我有六个表,我从中获取许多按创建日期分组的行。
例如 :
SELECT COUNT(*) AS NoOfReading FROM TableA
WHERE IsDeleted = 0
GROUP BY CONVERT(VARCHAR(10), CreatedDtUTC,111)
SELECT COUNT(*) AS NoOfReading FROM TableB
WHERE IsDeleted = 0
GROUP BY CONVERT(VARCHAR(10), CreatedDtUTC,111)
SELECT COUNT(*) AS NoOfReading FROM TableC
WHERE IsDeleted = 0
GROUP BY CONVERT(VARCHAR(10), CreatedDtUTC,111)
及以后..
现在我想sum of NoOfReading
按创建日期从所有表中分组。有什么解决办法??
PS:我尝试在所有查询之间使用“+”但给出错误。
谢谢