当确认转向存储过程不会破坏其预期功能时(数据从 A 点到达 B 点),我经常使用MINUS
(EXCEPT
在 sql server 中)。但是,这迫使我运行每个查询两次(因为减号返回存在于第一个/顶部表中但不存在于第二个/底部表中的行):
SELECT value1, value2, value3 FROM table1 WHERE uploadID = 'beforeTurning'
MINUS
SELECT value1, value2, value3 FROM table1 WHERE uploadID = 'afterTurning';
SELECT value1, value2, value3 FROM table1 WHERE uploadID = 'afterTurning'
MINUS
SELECT value1, value2, value3 FROM table1 WHERE uploadID = 'beforeTruning';
我可以用一个查询完成同样的事情吗?我该怎么做?