Created
June 20, 2018 10:42
-
-
Save ashugupt/696247852714eb730961d167511214af 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
SELECT | |
b.cluster_name, | |
SUM(a.total_shipments) AS total_shipments | |
FROM ( | |
SELECT | |
booking_cluster_id, | |
1 AS total_shipments | |
FROM shipment | |
WHERE 1=1 | |
AND timestamp BETWEEN '{{ last_sunday }}' | |
AND '{{ this_saturday }}' | |
) shipment | |
JOIN ( | |
SELECT | |
cluster_id, | |
cluster_name | |
FROM locations | |
WHERE 1=1 | |
AND timestamp BETWEEN '{{ latest_ds }}' | |
) b | |
ON (a.booking_cluster_id = b.cluster_id) | |
GROUP BY b.cluster_name; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment