Junior — Senior
Selection of unique user-product pairs until ban date
livecode
Task condition
You need to obtain a set of unique combinations of user and product identifier (SKU) for all purchases made before the user was added to the banned list. The result should be ordered first by the user's name, and then by the product code.
//user
id|firstname|lastname |birth
1 | Ivan | Petrov | 1996-05-01
2 | Anna | Petrova | 1996-06-01
3 | Ivan | Petrov | 1996-10-02
// 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-05-12
// ban_list
user_id | date_from
1 | 2021-03-08