Last active
August 13, 2016 12:23
-
-
Save dvreed77/4396ab9c68d8a4cc451ee19fff9a9316 to your computer and use it in GitHub Desktop.
This file contains 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 A AS ( | |
SELECT | |
"route_id", | |
"client_id", | |
"sales_channel_id", | |
"sales_depot_id" | |
FROM "test_prepared" | |
), | |
B AS ( | |
SELECT | |
"route_id", | |
"client_id", | |
"sales_channel_id", | |
"sales_depot_id" | |
FROM "train_prepared" | |
), | |
C AS ( | |
SELECT * FROM A | |
UNION | |
SELECT * FROM B | |
), | |
D AS ( | |
SELECT | |
"sales_depot_id", COUNT(*) FROM C | |
GROUP BY "sales_depot_id" | |
) | |
SELECT COUNT(*) FROM D |
This file contains 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 A AS ( | |
SELECT | |
"route_id", | |
"client_id", | |
"sales_channel_id", | |
"sales_depot_id" | |
FROM "test_prepared" | |
), | |
B AS ( | |
SELECT | |
"route_id", | |
"client_id", | |
"sales_channel_id", | |
"sales_depot_id" | |
FROM "train_prepared" | |
), | |
C AS ( | |
SELECT * FROM A | |
UNION | |
SELECT * FROM B | |
), | |
D AS ( | |
SELECT | |
"route_id", COUNT(*) FROM C | |
GROUP BY "route_id" | |
) | |
SELECT COUNT(*) FROM D |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment