I have an SQL Server 2014 database that stores data like this: We are assigning tasks to a week of a year. There can be 0 to any number of tasks per week and year. I would like to be able to format the table so it looks like the lower section here, with each taskID getting it's own column and so that weeks with no entries are still included.
I can format it in my application but presume it would be more efficient and perhaps easier to have it done in the db. Should I do the formatting in SQL or should I do it in application? What would the process be to do it in SQL if that would be preferable?