Introducing PopSQL + dbt
Say you're comparing two SQL Server columns and you want to know how many rows are different. No problem, you think:
where start_date != end_date;
Not so fast. If some of the start or end dates are null, they won't be counted! Surely that's not what you wanted. That's why you need to use the INTERSECT operator:
where not exists(select start_date intersect select end_date);
Now, your count will be “null aware” and you'll get the result you want.
Spread the word