-
-
Save ldenson11/19dc1d9640edf4bd25ae0be184621120 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
-- detect multiple auths in a short window | |
-- send to alerting framework | |
SELECT card, | |
MAX(amount) as theamount, | |
TUMBLE_END(eventTimestamp, interval '5' minute) as ts | |
FROM auths | |
WHERE lat IS NOT NULL | |
AND lon IS NOT NULL | |
GROUP BY card, TUMBLE(eventTimestamp, interval '5' minute) | |
HAVING COUNT(*) > 4 -- >4==fraud |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment