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)
 Survey tables

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2001-12-19 : 08:57:54
Dave writes "I have 3 tables.

CREATE TABLE [dbo].[tblSurveyAnswers] (
[MemberID] [int] NOT NULL ,
[QuestionID] [int] NOT NULL ,
[QuestionAnswer] [nvarchar] (500) NULL )
GO
CREATE TABLE [dbo].[tblSurveyQuestions] (
[SurveyID] [int] NOT NULL ,
[QuestionID] [int] IDENTITY (1, 1) NOT NULL ,
[QuestionText] [nvarchar] (500) NULL )
GO
CREATE TABLE [dbo].[tblSurveys] (
[SurveyID] [int] IDENTITY (1, 1) NOT NULL ,
[SurveyName] [varchar] (100) NOT NULL )
GO

I want to return a recordset for each survey that will contain data in the following format:

MemberID, QText1, QText2, QText3, etc.
Data retuned
10000,Answer1,Answer2,Answer3, etc.

This is a sort of crosstab type query however I do not want to perfom any calculations in getting back the data. Essentially I want to denormalise a normalised dataset."

JustinBigelow
SQL Gigolo

1157 Posts

Posted - 2001-12-19 : 09:05:51
Here's an article on building a cross-tab...

[url]http://www.sqlteam.com/item.asp?ItemID=2955[/url]

hth,
Justin

Go to Top of Page
   

- Advertisement -