January 25, 2015 at 10:03 am
Question, I have a query I select the data from it will return the data as such:
ManagerName EmployeeName HoursWork
John Mary 5
John Kelly 55
John Sue 80
John Cathy 35
Is there a statement I can use to have the same data display in a different format as such: (or do I have to write it using a Cursor)
John Mary Kelly Sue Cathy
5 55 80 35
January 25, 2015 at 10:13 am
kd11 (1/25/2015)
Question, I have a query I select the data from it will return the data as such:ManagerName EmployeeName HoursWork
John Mary 5
John Kelly 55
John Sue 80
John Cathy 35
Is there a statement I can use to have the same data display in a different format as such: (or do I have to write it using a Cursor)
John Mary Kelly Sue Cathy
5 55 80 35
There is, indeed. Please see the following article for how.
http://www.sqlservercentral.com/articles/Crosstab/65048/
If you want a code for your specific example, please see the article at the first link under "Helpful Links" in my signature block below.
--Jeff Moden
Change is inevitable... Change for the better is not.
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply