Last active
February 24, 2021 18:50
-
-
Save nfarah86/0812f33abe359072093d88fde5a893a8 to your computer and use it in GitHub Desktop.
Promo codes being used in certain regions of the U.S.
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 | |
oi.PromoID, | |
pc.PromoDescription, | |
ca.CustomerRegion, | |
COUNT(*) as totalPromoUsed | |
FROM | |
commons.orderItem oi | |
join commons.customerActivity ca on ca.CustomerID = oi.CustomerID | |
Join commons.promoCode pc on pc.PromoID = oi.PromoID | |
WHERE | |
oi.PromoID != 'nil' | |
and pc.PromoID = :promoid | |
Group by | |
oi.PromoID, | |
ca.CustomerRegion, | |
pc.PromoDescription | |
Order By | |
totalPromoUsed DESC | |
; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment