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)
 how to report vertical data horizontally???

Author  Topic 

wgpubs
Yak Posting Veteran

67 Posts

Posted - 2005-04-20 : 14:08:19
I have data reported as follows via a simple select query ...


AnsValue AnsCount
1 3
2 9
3 17
4 52
5 22
na 0


I would like to report this data horizontally as such ...

1 2 3 4 5 na
3 9 17 52 22 0

Basically AnsValue becomes the column and AnsCount becomes the column value. Any ideas on how to do this???

Thanks - wg

Vivaldi
Constraint Violating Yak Guru

298 Posts

Posted - 2005-04-20 : 15:36:55
I suppose telling you that Pivot will be available in sql server 2005 isn't going to help?

________________________________________________

Bier is a privelege of the working man (or woman).
Go to Top of Page

wgpubs
Yak Posting Veteran

67 Posts

Posted - 2005-04-20 : 15:41:21
unfortunately not at this point :)

any ideas on how to do it in SQL 2K would be helpful though :)
Go to Top of Page

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2005-04-20 : 15:44:44
either this
http://www.sqlteam.com/item.asp?ItemID=2955
or this
http://weblogs.sqlteam.com/mladenp/archive/2005/03/15/4260.aspx

which ever works for you.

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

- Advertisement -