Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- DROP VIEW IF EXISTS coach_salary_info;
- CREATE VIEW coach_salary_info AS
- SELECT DISTINCT
- c.name AS coach_name,
- CONCAT(sg.id, ' - ', sg.location) AS group_info,
- s.name AS sport_name,
- YEAR(sp.dateOfPayment) AS year,
- MONTH(sp.dateOfPayment) AS month,
- sp.salaryAmount
- FROM
- salaryPayments sp
- JOIN
- coaches c ON sp.coach_id = c.id
- JOIN
- coach_work cw ON sp.coach_id = cw.coach_id
- JOIN
- sportGroups sg ON cw.group_id = sg.id
- JOIN
- sports s ON sg.sport_id = s.id
- WHERE
- YEAR(sp.dateOfPayment) = '2024' AND MONTH(sp.dateOfPayment) = '4';
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement