-
-
Save ldenson11/ed800331e0eca6e85af7fc471d4cd211 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 * | |
FROM paymentauths | |
MATCH_RECOGNIZE( | |
PARTITION BY card | |
ORDER BY eventTimestamp | |
MEASURES | |
F.amount AS first_amount, | |
E.amount AS last_amount | |
ONE ROW PER MATCH | |
AFTER MATCH SKIP PAST LAST ROW | |
PATTERN (F+ E) -- match 1 or more rows | |
DEFINE | |
F AS F.amount IS NOT NULL AND F.amount > 10, -- lower boundary | |
E AS E.amount IS NOT NULL AND F.amount < E.amount) -- starting value less than ending value |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment