Loading problem...
A payments intelligence team tracks whether a customer shows an early spending surge.
Table: Transactions
Business rule: For each user, sort transactions by transaction_date in ascending order and inspect only that user's third transaction. A user qualifies if and only if:
Return exactly these columns in this order:
Sort the final result by user_id ascending.
Supported submission environments:
Transactions:
| user_id | spend | transaction_date |
|---------|-------|----------------------|
| 1 | 7.44 | 2024-01-02 12:15:23 |
| 1 | 49.78 | 2024-01-12 00:13:46 |
| 1 | 65.56 | 2024-01-18 13:49:42 |
| 1 | 96.00 | 2024-01-30 02:47:26 |
| 2 | 40.89 | 2024-01-20 07:39:34 |
| 2 | 100.44| 2024-01-21 04:39:15 |
| 3 | 37.33 | 2024-01-03 06:22:02 |
| 3 | 13.89 | 2024-01-11 16:00:14 |
| 3 | 7.00 | 2024-01-29 22:32:36 |[
{"user_id":1,"third_transaction_spend":65.56,"third_transaction_date":"2024-01-18 13:49:42"}
]User 1 qualifies because the third spend (65.56) is greater than both first (7.44) and second (49.78). User 2 has only two transactions. User 3 has a third transaction, but 7.00 is not greater than the first two spends.
Transactions:
| user_id | spend | transaction_date |
|---------|-------|----------------------|
| 5 | 30.00 | 2024-02-01 09:00:00 |
| 5 | 45.00 | 2024-02-01 09:30:00 |
| 5 | 46.00 | 2024-02-02 10:00:00 |
| 5 | 5.00 | 2024-02-10 10:00:00 |
| 6 | 100.00| 2024-03-01 08:00:00 |
| 6 | 90.00 | 2024-03-02 08:00:00 |
| 6 | 95.00 | 2024-03-03 08:00:00 |
| 6 | 500.00| 2024-03-04 08:00:00 |[
{"user_id":5,"third_transaction_spend":46.0,"third_transaction_date":"2024-02-02 10:00:00"}
]For user 5, the third spend is greater than both first and second spends. For user 6, the third spend (95.00) is not greater than the first spend (100.00), so the user is excluded even though the fourth spend is high.
Transactions:
| user_id | spend | transaction_date |
|---------|-------|----------------------|
| 9 | 0.00 | 2024-04-01 00:00:00 |
| 9 | 0.00 | 2024-04-02 00:00:00 |
| 9 | 1.00 | 2024-04-03 00:00:00 |
| 10 | 12.50 | 2024-05-01 09:00:00 |
| 10 | 12.50 | 2024-05-02 09:00:00 |
| 10 | 12.50 | 2024-05-03 09:00:00 |[
{"user_id":9,"third_transaction_spend":1.0,"third_transaction_date":"2024-04-03 00:00:00"}
]Strict inequality matters. User 9 qualifies because 1.00 > 0.00 and 1.00 > 0.00. User 10 does not qualify because the third spend equals both previous spends.
Constraints