MySQL Forums
Forum List  »  Newbie

help me to construct the query
Posted by: Anees Anees
Date: December 12, 2008 11:09AM

Hi,

I have 3 tables

Questions
--------------
Q_id
Qustion

Common_answers
----------------------------
common_id
user_id

All_answers
------------------
id
Q _id
Answer(Y/N)
common_id


Its a survey type of questions. Users can answers how many times they want (either Yes or No for each question).
Each time they answers, one record will be stored into 'Common_answers'
And all question's answers will be stored into 'All_answers' with one 'common_id'

i need to get a report to list how many times he answered with answer 'Y', total number of attempts and the percentage of Yes.
for eg:
Question 1 50%(3 of 6)
Question 2 100%(6 of 6)
Question 3 0%(0 of 6)
Question 4 66.67%(4 of 6)


Is it possible to get all these data from database using one query
I have tried to get the desired output but couldn't succeed yet
Please help in queries to get these results

Regards
Anees

Options: ReplyQuote


Subject
Written By
Posted
help me to construct the query
December 12, 2008 11:09AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.