September 9, 2016 at 12:26 am
Hello,
I want to display count of records whose null count is greater than 1 group by customer.
e.g.
coulumn1 column2
null 1
null 1
123 1
345 1
I want to find such records whose null count for coulumn1 is greater than 1 group by column2.
Please advice on above query.
Regards
Shirish phadnis
September 9, 2016 at 1:04 am
Something like this..
SELECT Column2, SUM( CASE WHEN Column1 IS NULL THEN 1 ELSE 0 END ) AS NullCount
FROM TableName
GROUP BY Column2
HAVING SUM( CASE WHEN Column1 IS NULL THEN 1 ELSE 0 END ) > 1;
How to post data/code on a forum to get the best help - Jeff Moden
http://www.sqlservercentral.com/articles/Best+Practices/61537/
September 9, 2016 at 1:37 am
Thanx Kingston.
It works
Viewing 3 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply