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)
 Selecting pivot table like data results

Author  Topic 

TonyM
Starting Member

1 Post

Posted - 2005-03-18 : 11:55:14
Hi all!
I'm stumped, and wanted to see if anyone had any ideas.
I'm making a dynamic report, that looks like something that is returned from a pivot table cube, but I can't use either a cube or a pivot table because of software limitations. Here is an example of what may be returned (fields can all change, but the structure with different levels on the columns and rows is what is killing me)

I was figuring on pulling the data in one column at a time, and then piecing it together. The problem is that I need to have the same number of rows come back each time, and I don't know how to do that if there aren't matching values for the row. All of the data is in one view, and the returning values are counts of data rows that match the criteria. Any thoughts? Thanks!

(Year) 2004
(Quarter)1 2
(Company)Comp1 Comp2 Comp1 Comp2 Total

Level 1 Level 2 Level 3
East 1 Yes 0 0 0 0 0
No 2 7 2 2 13
2 Yes 1 1 1 1 4
No 0 0 0 0 0
West 1 Yes 3 4 4 4 15
No 23 23 23 23 92
2 Yes 21 6 21 21 69
No 5 5 5 5 20
Total 67 58 66 68 213


--Tony

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2005-03-18 : 12:02:39
could you please format the data with [c o d e] your code here [/ c o d e] blocks (without spaces)
because i can't figure out the format your trying to get.

Go with the flow & have fun! Else fight the flow
Go to Top of Page
   

- Advertisement -