0
我正在尝试计算针对具有特定变量的服务器数量相同的子查询计数的服务器数量。我可以返回一个实体的资产总数,但是当我返回符合条件的资产总数时,它会给我的总数而不是我具体业务的数量。SQL嵌套或相关查询
SELECT DATEPART(week, GETDATE()) AS WEEK, bt.TranslatedParentBusiness AS [Parent Business], count(cars.ServerID) as [Count of Servers],
(Select count(auth.serverID) from AuthTracking auth where [AUTH STATUS] like 'PASSED')
FROM ASSETS.dbo._CARS AS cars INNER JOIN
ASSETS.dbo.BU_Translation AS bt ON cars.CARS_SubBusiness = bt.[CARS Sub Business]
GROUP BY bt.TranslatedParentBusiness
尝试COUNT(*),而不是计数(cars.ServerID) – Sankara