Advertisement

08.31.2007 at 12:49AM PDT, ID: 22799408
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

6.8

update query with sum and group by

Asked by VirusMinus in Access Architecture/Design, Microsoft Access Database, SQL Query Syntax

Tags: , ,

I have a quiz Q & A database (MS Access), where members can ask and answer questions and also vote on other answers and questions.

sample data and table structure / fields:

------------
questions
------------
q_id      q_title                topic_name      member_id
1         why is?                 Math                     17
2         what for?               Physics               20
3         How about?            Math                  18
4         and this?               Biology                 20
5         also by?                Physics               18


-----------
answers
-----------
a_id   answer_text      q_id      member_id
1       it is!                      1             18
2       not bad                 2             20
3       for me                  4              17
4       you are                  1             17
5       likely to                  3             18


-----------
avotes
-----------
vote_id   a_id     member_id     vote
1              4              18               1
2              3              20               1
3              1              17               1
4              4              17              -1
5              2              18               1


---------------------------------------------
qvotes
---------------------------------------------
vote_id   q_id     member_id     vote
1              4              18               1
2              3              20               1
3              1              17               1
4              4              17              -1
5              2              18               1


------------
members
------------
member_id      member_name    total_votes
17                        Dave                      ?
20                        Simon                     ?
18                        Alice                       ?


I have a query that gives me the total votes for each member (total of their votes from avotes and qvotes):

SELECT member_id, SUM(vote) as tvotes FROM
(SELECT member_id, Vote FROM avotes UNION ALL SELECT member_id, Vote FROM qvotes)
GROUP BY member_id

I have now created a total_votes field and want to fill this field with the tvotes that i can see in the previous query.

I tried this but its not working, i get syntax errors:

UPDATE members AS m, (Select member_id, sum(vote) as tvotes from (select member_id, Vote from avotes Union all select member_id, Vote from qvotes) Group by member_id AS v
SET m.total_votes = v.tvotes
WHERE m.member_id = v.member_id

and also this;

UPDATE members AS m INNER JOIN ((Select member_id, sum(Vote) as tvotes from (select member_id, Vote from avotes Union all select member_id, Vote from qvotes) Group by member_id) as v ON m.member_id = v.member_id
SET m.total_votes = v.tvotesStart Free Trial
[+][-]08.31.2007 at 01:19AM PDT, ID: 19806633

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08.31.2007 at 01:25AM PDT, ID: 19806655

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]08.31.2007 at 01:36AM PDT, ID: 19806682

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08.31.2007 at 04:09AM PDT, ID: 19807157

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]08.31.2007 at 06:00AM PDT, ID: 19807684

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08.31.2007 at 06:01AM PDT, ID: 19807692

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08.31.2007 at 09:53PM PDT, ID: 19812703

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]09.01.2007 at 03:22AM PDT, ID: 19813339

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]09.02.2007 at 12:13AM PDT, ID: 19816331

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]09.02.2007 at 01:21PM PDT, ID: 19817972

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Access Architecture/Design, Microsoft Access Database, SQL Query Syntax
Tags: update, sum, query
Sign Up Now!
Solution Provided By: LPurvis
Participating Experts: 2
Solution Grade: A
 
 
[+][-]09.13.2007 at 07:19PM PDT, ID: 19888591

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_1_20070628