0

I checked a lot of answer for similar questions but I didn't find the right answer. I have table Employee: enter image description here

and another table EmployeeLeave: enter image description here

Now I need to convert rows into columns like this:

enter image description here

Hussein
  • 945
  • 1
  • 12
  • 30
  • 2
    _"Where Column No not Known"_ ? However, search for [`PIVOT`](https://technet.microsoft.com/en-us/library/ms177410(v=SQL.105).aspx). – Tim Schmelter Jul 10 '15 at 12:15
  • "Column No not known" means probably, that the number of columns (count of differen LeaveTypes) is unknow, PIVOT is the right hint, but is tricky if you want to extent this list. Please give some details... – Shnugo Jul 10 '15 at 12:18
  • @Shnugo : the list goes one distinct Employee per row and number of additional columns will depend on the number of leaves – Hussein Jul 10 '15 at 12:22
  • Dynamic SQL using Pivot See [prior posts](http://stackoverflow.com/questions/10404348/sql-server-dynamic-pivot-query) – xQbert Jul 10 '15 at 12:32
  • Google DYNAMIC PIVOT. – Tab Alleman Jul 10 '15 at 12:47

0 Answers0