SELECT customerid FROM T_TableName
GROUP BY customerid HAVING
SUM (CASE
WHEN AccountNumber IS NULL THEN 0
ELSE 1
END
)=0
GO
The above query return unique customerid from table T_Tablename if customerid is more than one.
Also it only return if the customerid is having NULL value for all the records. If they have proper account number instead of NULL, the query would not return the customerid.
No comments:
Post a Comment