Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Create Fake Crosstab

Status
Not open for further replies.

CrystalVis

Technical User
Jun 26, 2002
200
US
I have a result table with the following data layout (no key field, this is it):
As_of_Date Email_Created Email_Sent No_Subscribers
9/11/2003 121 70 485
9/18/2003 180 87 1308
9/25/2003 249 148 2460
etc...
How can I format so that the data will look like this


9/11/2003 9/18/2003 9/25/2003...
Email_Created 121 180 249
Email_Sent 70 87 148
No_Subscribers 485 1308 2460

I want to create a crosstab layout but reverse the columns and rows as you see in the example. Your help/suggestion is greatly appreciated.
Thanks
 
well... this is very easy in Ms-Access
TRANSFORM....PIVOT

I havent seen anything for T-SQL yet that can do it.
I read stuff about using SQL 2000 with XML.
 
I need sql expert help!!!Can this be accomplish in SQL?
 
Crosstab queries can be done in TSQL but they're not straightforward, even less so when you have a variable amount of columns as you have in your example.

Do a search in this forum for "crosstab" - there are lots of posts on this subject as it crops up quite regularly.

--James
 
Thank you all for your input/suggestion. I knew this would be tough accomplish. Right now, I'm using Crystal Report to create a fake crosstab. The data is perfectly displayed for the first 14 weeks. After that, it is totally messy. That is why I need to figure this out in SQL. If you can think of anything else, please let me know.

mimi2,
thanks for the link. i'll give it a try.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top