Created
February 24, 2021 06:52
-
-
Save nfarah86/b62c9a4188e150bb1df5373f5c322368 to your computer and use it in GitHub Desktop.
Customers who added items to their shopping cart and did not purchase
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
-- Note: peak time is 14; we hardcorded because of the way the sample data is. Normally we would use current timestamp. | |
SELECT | |
ca.CustomerID, ca.CustomerEmail, ca._event_time | |
FROM | |
commons.CustomerActivity ca | |
WHERE | |
NOT EXISTS ( | |
SELECT | |
oi.CustomerID | |
FROM | |
commons.OrderItem oi | |
WHERE | |
ca.CustomerID= oi.CustomerID) and ca._event_time > ((PARSE_TIMESTAMP_ISO8601('2021-01-25T16:23:29.000000Z')) - SECONDS(:timeElapsed)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment