Created
August 12, 2022 16:15
-
-
Save Meussdorffer/f6b91c8e21d1fdca7446e484cbe587a2 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 | |
'letter' AS resource, | |
CASE | |
WHEN size = 'A5' THEN '5.8x8.3' | |
ELSE size | |
END AS size, | |
COUNT(*) AS page_count | |
FROM lob.letters l | |
WHERE | |
l.send_date >= date_trunc('month', current_date - interval '1 month') | |
AND l.send_date < date_trunc('month', current_date) | |
GROUP BY 1, 2 | |
UNION ... | |
-- similar queries for other types of mailpieces below |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment