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)
 Getting Results in the right format

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2005-10-06 : 07:55:53
Kelly writes "Hi.
I wouldn't mind talking with someone on this, because it may prove difficult to explain on a forum.
Here is the scenario:
I have a very large database that I am pulling data out of. The data is grouped and sorted blah blah blah.
Once I have a near-final set of data, it is about 10-20 rows. The data is very inter-related data, and I need to kind of combine rows using some sort of temp table or cursor or for-next statement. I just don't have a clue where to begin.

Here is the layout:

Year name1 desc1 cms1 excl ID1
---------------------------------------------------------
2004 141.1 somedesc NULL 0 54777
2004 141.1 somedesc NULL 1 54777
2005 141.1 somedesc NULL 0 54777
2003 733 somedesc2 NULL 0 54777
2004 733 somedesc2 NULL 1 54777

Anyway, this is a start.
The client wants this data to come out looking like this:

Year2005 Year2004 Year2003 Name1 Desc1 cms
----------------------------------------------------------
x x 141.1 somed NULL
x x 733 somed2 NULL
"

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2005-10-06 : 08:00:32
Refer more Crosstabs here
http://weblogs.sqlteam.com/jeffs/archive/2005/05.aspx

Madhivanan

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

- Advertisement -