我正在尝试从两个查询的联合中进行选择 这两个查询的联合给了我 90,000 条记录,但是当我选择它们的总和时,它给了我 89,800 条记录。因此,总和正在减少记录的数量。
Select Site,building,...,
SUM(PhysicalCount) as PhysicalResult
From(
Select Site,building,...,
Count(TagID) as PhysicalCount
FROM Physical
Where <SomeCondition1>
Union
Select Site,building,...,
Count(TagID) as PhysicalCount
FROM Physical
Where <SomeCondition2>
) T1
Group by Site,building,...,