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 can I write a stored procedure to generate the

Author  Topic 

waterding
Starting Member

6 Posts

Posted - 2008-06-18 : 05:20:44
How can I write a stored procedure to generate the below data table?


Name QuestionDescription1 QuestionDesription2 TotalScore
Amy 2 (This is the socre) 3 5
Robert 0 4 4
Mill 1 2 3


The database structure is as below:

Question(Id,Description)

UserScore(Id, UserId, QuestionId, Score)

User(Id,Name, TotalScore)


Thanks in advance!!!

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-06-18 : 05:43:55
Do a search for CROSSTAB or PIVOT queries here on SQLTeam.
You will find many many examples.



E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page

waterding
Starting Member

6 Posts

Posted - 2008-06-19 : 04:52:03
quote:
Originally posted by Peso

Do a search for CROSSTAB or PIVOT queries here on SQLTeam.
You will find many many examples.



E 12°55'05.25"
N 56°04'39.16"




Thanks Peso, I have solved it.
Go to Top of Page
   

- Advertisement -