Last active
April 8, 2022 10:31
-
-
Save larsar/77499ce5772b93ef09303ef37699739e to your computer and use it in GitHub Desktop.
Diff result from two different SQL queries
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
WITH query1 AS (SELECT * FROM ...), | |
query2 AS (SELECT * FROM ...), | |
in_query1 AS (SELECT * FROM query1 EXCEPT SELECT * FROM query2), | |
in_query2 AS (SELECT * FROM query2 EXCEPT SELECT * FROM query1) | |
SELECT 'query1' AS query, * | |
FROM in_query1 | |
UNION ALL | |
SELECT 'query2' AS query, * | |
FROM in_query2; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment