I have three tables:
user(id, name);
tasks(id, user_id, text, date);
bonus(id, user_id, sum, date, type).
I’m trying to write a query that will give me a list of all users, quantity of their tasks and a sum of bonuses of every type, each in separate column.
There are three types of bonuses:
type = (1, 2, 3)
So, I mean a table, which looks like this
name | task_count | bonus_1 | bonus_2 | bonus_3
1 Answer