Junior — Senior
Users with purchases over 5000 before ban
livecode
Task condition
It is necessary to identify clients whose total purchase amount exceeded 5000 before their account was blocked. Display the results as: identifier | first name | last name | total purchase amount.
Table "user"
+----+-----------+----------+------------+
| id | firstname | lastname | birth |
+----+-----------+----------+------------+
| 1 | Ivan | Petrov | 1996-05-01 |
| 2 | Anna | Petrova | 1999-06-01 |
| 3 | Anna | Petrova | 1990-10-02 |
+----+-----------+----------+------------+
Table "purchase"
+-----+-------+---------+------------+
| sku | price | user_id | date |
+-----+-------+---------+------------+
| 1 | 5500 | 1 | 2021-02-15 |
| 1 | 5700 | 1 | 2021-01-15 |
| 2 | 4000 | 1 | 2021-02-14 |
| 3 | 8000 | 2 | 2021-03-01 |
| 4 | 400 | 2 | 2021-03-02 |
+-----+-------+---------+------------+
Table "ban_list"
+---------+------------+
| user_id | date_from |
+---------+------------+
| 1 | 2021-03-08 |
+---------+------------+