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)
 Column formating

Author  Topic 

bjcc77
Starting Member

5 Posts

Posted - 2006-02-23 : 08:29:57
Hi
I have some a table result like this

Ref Desc Date Amt
2743 Deposit 12/01/06 350
2743 Deposit 15/01/06 300
2743 Final 17/01/06 340
2744 Deposit 16/01/06 255
2744 Final 18/01/06 344
2745 Deposit 19/01/06 850
2745 Deposit 25/01/06 400
2745 Final 27/01/06 400



I need the rows turned into columns to look like this

Ref Desc1 Date 1 Amt1 Desc2 Date2 Amt2 Desc3 Date3 Amt3
2743 Deposit 12/01/06 350 Deposit 15/01/06 300 Final 17/01/06 340
2744 Deposit 16/01/06 255 Final 18/01/06 344 Null null null
2745 Deposit 19/01/06 850 Deposit 25/01/06 400 Final 27/01/06 400

The reference number is the only common column



madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2006-02-23 : 08:50:41
Refer this
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 -