Advertisement
elena1234

PIVOT ( T-SQL) - broken out by Gender

Mar 8th, 2022 (edited)
1,976
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
T-SQL 0.27 KB | None | 0 0
  1. SELECT
  2. [Employee Gender] = Gender,
  3. [Sales Representative],
  4. [Buyer],
  5. [Janitor]
  6. FROM
  7. (
  8. SELECT
  9. JobTitle,
  10. VacationHours,
  11. Gender
  12. FROM HumanResources.Employee
  13. ) AS A
  14.  
  15. PIVOT(
  16. AVG(VacationHours)
  17. FOR JobTitle IN([Sales Representative], [Buyer], [Janitor])
  18. ) AS B
  19.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement