Advertisement
vallec

Untitled

Apr 8th, 2024
17
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. DROP VIEW IF EXISTS coach_salary_info;
  2. CREATE VIEW coach_salary_info AS
  3. SELECT DISTINCT
  4. c.name AS coach_name,
  5. CONCAT(sg.id, ' - ', sg.location) AS group_info,
  6. s.name AS sport_name,
  7. YEAR(sp.dateOfPayment) AS year,
  8. MONTH(sp.dateOfPayment) AS month,
  9. sp.salaryAmount
  10. FROM
  11. salaryPayments sp
  12. JOIN
  13. coaches c ON sp.coach_id = c.id
  14. JOIN
  15. coach_work cw ON sp.coach_id = cw.coach_id
  16. JOIN
  17. sportGroups sg ON cw.group_id = sg.id
  18. JOIN
  19. sports s ON sg.sport_id = s.id
  20. WHERE
  21. YEAR(sp.dateOfPayment) = '2024' AND MONTH(sp.dateOfPayment) = '4';
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement