admin管理员组

文章数量:1336367

I'm comparing to tables with the following:

WHERE tab1.id_1::date between 'YYYY-MM-DD' AND 'YYYY-MM-DD'
AND ((tab1.id_2 IS DISTINCT FROM tab2.id_2)
OR (tab1.id_3 IS DISTINCT FROM tab2.id_3)
OR (tab1.id_4 IS DISTINCT FROM tab2.id_4)
... -- a lot more conditions
)

The query is currently returning a large number of rows, many of which appear identical upon closer inspection. To optimize the result set, I only need to retrieve rows where at least one column differs between the two tables. Additionally, if two columns both contain null values, they should be considered equal and not included in the result set.

Thoughts?

本文标签: SnowflakeIS DISTINCT FROMStack Overflow