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
 General SQL Server Forums
 New to SQL Server Programming
 Count Record

Author  Topic 

dreamman
Starting Member

4 Posts

Posted - 2010-03-15 : 12:07:55
Hi,

Answers to our questionnaire DBAnswers table are kept, according to this table you see the following DumpResults, DumpResults2 Can we write the query?

Answers are given between 1-5 and which was given to question how many and what percentage of the answer we want to learn.

Could help to friends, thank you.



DumpAnswers (Source table)
AnswerID ScoolCode YearID QuestionID Answer
1043 888888 2 313 1
1044 888888 2 292 2
1045 888888 2 293 2
1046 888888 2 294 5
1047 888888 2 295 4

Sample DumpQueryResults (How a query for below result?)
ScoolCode YearID QuestionID Answer1Count Answer2Count Answer3Count Answer4Count Answer5Count
888888 2 313 0 2 4 8 290
888888 2 292 5 4 3 9 195
888888 2 293 8 3 5 7 202
888888 2 294 1 19 4 3 211
888888 2 295 1 7 9 6 300



Sample DumpQueryResults2 (How a query for below result?)
ScoolCode DonemID QuestionID Answer1percent Answer2percent Answer3percent Answer4percent Answer5percent
888888 2 313 0 2 4 8 86
888888 2 292 5 4 3 9 79
888888 2 293 8 3 5 7 77
888888 2 294 1 19 4 3 73
888888 2 295 1 7 9 6 77

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2010-03-15 : 12:11:57
I cant understand your explanation. whats the output you're expecting out of above data?

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

dreamman
Starting Member

4 Posts

Posted - 2010-03-15 : 12:19:32
Ben DumpAnswers Tablosuna bir sorgu yazarak DumpResults tablosunu elde etmek istiyorum. nasil bir sorgu yazacagimi bilemiyorum.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2010-03-15 : 12:22:53
quote:
Originally posted by dreamman

Ben DumpAnswers Tablosuna bir sorgu yazarak DumpResults tablosunu elde etmek istiyorum. nasil bir sorgu yazacagimi bilemiyorum.


please translate this in english

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2010-03-15 : 12:24:43
quote:
Originally posted by dreamman

Ben DumpAnswers Tablosuna bir sorgu yazarak DumpResults tablosunu elde etmek istiyorum. nasil bir sorgu yazacagimi bilemiyorum.


Oh! Now everything is clear


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

dreamman
Starting Member

4 Posts

Posted - 2010-03-15 : 18:22:33
i am so sory.

I'm typing a query for DumpAnswers Table. i want as a table DumpResults. I do not know how to write a query.
Go to Top of Page

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2010-03-15 : 18:25:22
So can you tell us the rules how this
'1043 888888 2 313 1'
would become this
'888888 2 313 0 2 4 8 290'
Where do '0 2 4 8 290' come from?


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

dreamman
Starting Member

4 Posts

Posted - 2010-03-15 : 21:36:49
I'm doing a survey. Each question is given a score between 1 and 5. What I question, for which the answer I want to calculate how many people vote.
Example:
Question 313, 1 point 3 people, 2 point 5 people, 3 points 50 people, etc. ... To obtain a result that is as follows DumpQueryResults want.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2010-03-16 : 00:05:45
where do you store the voted people info?

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -