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.
| Author |
Topic |
|
sqldba2k6
Posting Yak Master
176 Posts |
Posted - 2006-10-12 : 16:36:38
|
| Please help me in the writing the query.I have data in a table below.id rcode-- -----101 A1102 A1101 A2102 A2113 A2120 A2101 A3102 A3108 A3124 A3102 A4102 A5106 A5I want the output like below:id A1 A2 A3 A4 A5--- -- ---- --- --- ---101 A1 A2 A3 null null102 A1 A2 A3 A4 A5106 null null null null A5108 null null A3 null null 113 null A2 null null null120 null A2 null null null124 null null A3 null null |
|
|
jezemine
Master Smack Fu Yak Hacker
2886 Posts |
Posted - 2006-10-12 : 16:41:58
|
| take a look at GROUP BY and CASE in bol.SqlSpec - a fast, cheap, and comprehensive data dictionary generator for SQL Server 2000 and 2005 - http://www.elsasoft.org |
 |
|
|
snSQL
Master Smack Fu Yak Hacker
1837 Posts |
Posted - 2006-10-12 : 16:42:01
|
| What you're looking for is a crosstab query, which you do with the PIVOT clause in SQL Server 2005, but in SQL Server 2000 you'll need to code it yourself or read this excellent article and find out how to code it:http://www.sqlteam.com/item.asp?ItemID=2955 |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
|
|
|
|
|