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.
Author |
Topic |
dewacorp.alliances
452 Posts |
Posted - 2008-03-28 : 15:46:10
|
Hi GuruI have 2 simplified tables like thisCREATE TABLE [FormAnswers] ( [FormAnswerID] [bigint] IDENTITY (1, 1) NOT NULL , [FormQuestionID] [bigint] NULL , [UserID] [bigint] NULL , [FormAnswer1] [varchar] (255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL , [FormAnswer2] [varchar] (255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL) ON [PRIMARY]GOCREATE TABLE [FormQuestions] ( [FormQuestionID] [bigint] IDENTITY (1, 1) NOT NULL , [FormID] [bigint] NULL , [FormQuestionTypeID] [int] NULL , [DisplayOrder] [int] NULL , [FormQuestionCode] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL , [FormQuestionName] [varchar] (100) COLLATE SQL_Latin1_General_CP1_CI_AS NULL , [FormQuestionText] [varchar] (500) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ) ON [PRIMARY]GOI want to create a pivot report that somehow like this:====================================================================|*Questions*|**********UserID1**********|**********UserID2 etc****** |*********|*FormAnswer1*|*FormAnswer2**|*FormAnswer1*|*FormAnswer2*====================================================================| Your Name | Yes | N/A | No | Yes | Your age | 1 | <null> | 2 | <null>etcThank you |
|
rmiao
Master Smack Fu Yak Hacker
7266 Posts |
Posted - 2008-03-28 : 22:57:16
|
Take look at 'cross-tab report' in books online. |
 |
|
|
|
|