SQL - Getting count by Distinct based on Type [closed]
Solution 1:
Count those that are not 7 distinct. (NULL isn't counted)
Then add the total unique id's of 7.
COUNT(DISTINCT CASE WHEN TypeId = 7 THEN NULL ELSE Id END) +
COUNT(DISTINCT CASE WHEN TypeId = 7 THEN Id END)