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?
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1742391107a4435033.html
评论列表(0条)