Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 pivot format (more rows in a single row)

Author  Topic 

karthikeyan.marlen
Starting Member

16 Posts

Posted - 2011-11-25 : 06:00:00
Hi
I am having a table like
ECA(extra curricular)

ID Name ECA marks
1 aa cricket 100

1 aa yoga 90

2 bb yoga 89

2 bb football 90

2 bb medit 78

and i want to view this table as

ID Name ECA1 mark1 ECA2 mark2 ECA3 mark3

1 aa cricket 100 yoga 90 - -

2 bb yoga 89 football 90 medit 78

Pls provide me a solution for this,thanks in advance

karthikeyan

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2011-11-25 : 07:00:20
Try this code
http://beyondrelational.com/blogs/madhivanan/archive/2007/08/27/dynamic-crosstab-with-multiple-pivot-columns.aspx

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

sql-programmers
Posting Yak Master

190 Posts

Posted - 2011-11-28 : 06:01:24
I have a blog article to maybe assist you with your question,

http://www.sql-programmers.com/Blog/tabid/153/EntryId/6/Using-PIVOT-and-UNPIVOT.aspx

SQL Server Programmers and Consultants
http://www.sql-programmers.com/
Go to Top of Page
   

- Advertisement -