October 8, 2010 at 3:33 am
Good morning all
I have a table that looks like this:
Count Bin Date
1 2AA 25/09/2010
2 2AA 03/10/2010
3 2AA 09/10/2010
1 3BC 03/08/2010
2 3BC 04/09/2010
3 3BC 01/10/2010
etc.
What I need is the following:
Bin 1 2 3
2AA 25/09/2010 03/10/2010 09/10/2010
3BC 03/08/2010 04/09/2010 01/10/2010
etc.
Is this at all possible?
Regards
Jean
October 8, 2010 at 3:50 am
Have a look in BOL at the PIVOT function, might do the trick for you.
October 8, 2010 at 5:19 am
Take a look at the articles linked to in my signature under Cross-Tabs and Pivots, Part 1 and Part 2.
Wayne
Microsoft Certified Master: SQL Server 2008
Author - SQL Server T-SQL Recipes
October 8, 2010 at 5:50 am
Thanks Wayne
Problem solved!
October 10, 2010 at 10:06 pm
grahamc (10/8/2010)
Have a look in BOL at the PIVOT function, might do the trick for you.
As a side bar, you might want to take a look at the two articles Wayne spoke of in his post. There's a pretty good speed advantage to using a good ol' fashioned Cross-Tab instead of a Pivot.
--Jeff Moden
Change is inevitable... Change for the better is not.
Viewing 5 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply