saravanatn - Wednesday, December 6, 2017 7:28 PM
This returns the above results:WITH CountsandNulls AS (
SELECT
id
, name
, city
, place
, COUNT(*) OVER (PARTITION BY id) AS RowsPerID
, CASE
WHEN name + city + place IS NULL THEN 1
ELSE 0
END AS HasNulls
FROM details
)
SELECT
id
, name
, city
, place
FROM CountsandNulls
WHERE RowsPerID = 1
OR HasNulls = 0;
Can you please buy read and study a book on logic? The (correct) premise "if we need to do arithmetic on a column then the column must have a numeric data type" does not imply "if we do not need to do arithmetic on a column then the column must not have a numeric data type", any more than "if I need to drive a car it must have wheels" implies "if nobody needs to drive a car it must not have wheels".
saravanatn - Thursday, December 7, 2017 10:57 PM
John