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
 SQL Server Development (2000)
 Complex Query

Author  Topic 

Fatalsniper
Starting Member

45 Posts

Posted - 2005-12-06 : 17:40:26
Hey guys!,

I have this table

Date.........................SUM...name
--------------------------- ----- -----------
2005-11-10 00:00:00.000-----4------John
2005-11-03 00:00:00.000-----16-----user1
2005-11-04 00:00:00.000-----12-----user2
.
.
2005-11-09 00:00:00.000-----15-----userN

and I want to TRANSFORM it to this...

Date........................John....User1..Total_Amount
--------------------------- ------- ---- -----------
2005-11-03 00:00:00.000....16......0......16
2005-11-04 00:00:00.000....12......0......12
2005-11-08 00:00:00.000....7.......4......11

And get all users as columns instead rows...dynamicly if possible

Any suggestions???

Thanks in advance...

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2005-12-06 : 19:44:04
see here
[url]http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=6216[/url]

-----------------
[KH]
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2005-12-07 : 01:27:36
Also
http://weblogs.sqlteam.com/jeffs/archive/2005/05.aspx

Madhivanan

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

- Advertisement -