更新WHERE子句以检查值是否不在单独的表中
我有一个使用WHERE子句的查询,并且碰巧在此表的许多查询中使用了完全相同的WHERE子句(等)。 查询是: SELECT DATENAME(DW, [AtDateTime]) AS [Day of Week] ,COUNT(*) AS [Number of Searches] ,CAST(CAST(COUNT(*) AS DECIMAL(10, 2)) / COUNT(DISTINCT CONVERT(DATE, [AtDateTime])) AS DECIMAL(10, 2)) AS [Average Searches per Day] ,SUM(CASE WHEN [NumFound] = 0 THEN 1 ELSE 0 END) AS [Number of Searches with no Results] ,CAST(CAST(SUM(CASE WHEN [NumFound] …