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 2000 Forums
 Transact-SQL (2000)
 sql query help

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2006-08-08 : 07:41:37
saju writes "Table Structure


SlNo PeriodName Subject Day
==================================

1 PeriodName1 sub1 1
2 PeriodName2 sub2 1
3 PeriodName3 sub3 1
4 PeriodName4 sub4 1
5 PeriodName5 sub5 1
6 PeriodName6 sub6 1
7 PeriodName7 sub7 2
8 PeriodName1 sub7 2
9 PeriodName2 sub6 2
10 PeriodName3 sub5 2
11 PeriodName4 sub4 2
12 PeriodName5 sub3 2
13 PeriodName6 sub2 2
14 PeriodName7 sub1 2

SO ON


Here 1 =Monday
2 =Tuesday


How can I rotate this table based on " Period Name " .plz note that the row may vary in d/f case

plz give help for create any SQL query or sp



out should be look like this




Day PeriodName1 PeriodName2 PeriodName3 PeriodName4 PeriodName5 PeriodName6 PeriodName7
----------------------------------------------------------------------------------------
1 sub1 sub2 sub3 sub4 sub5 sub6 sub7
2 sub7 sub6 sub5 sub4 sub3 sub2 sub1
"

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2006-08-08 : 12:39:16
Read about Cross-tab Reports in sql server help file
Also refer
http://sqljunkies.com/WebLog/amachanic/archive/2004/11/10/5065.aspx?Pending=true


Madhivanan

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

- Advertisement -