You would mostly be using COUNT
to summarize over a UID. Therefore
COUNT([uid])
will produce the warning:
Warning: Null value is eliminated by an aggregate or other SET operation.
whilst being used with a left join, where the counted object does not exist.
Using COUNT(*)
in this case would also render incorrect results, as you would then be counting the total number of results (ie parents) that exist.
Using COUNT([uid])
IS a valid way of counting, and the warning is nothing more than a warning. However if you are concerned, and you want to get a true count of uids in this case then you could use:
SUM(CASE WHEN [uid] IS NULL THEN 0 ELSE 1 END) AS [new_count]
This would not add a lot of overheads to your query.
(tested mssql 2008)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…