I have a sql command that selects AVG score from two tables, php/mysql, but it

Technerd_Shawn

New member
returns empty? I have a sql command that selects AVG score from two tables, php/mysql, but it returns empty if one of the tables dosnt have a score for the employee..

so here it is

SELECT (
(SUM(QA_Scores.score_total) + SUM(qaform.qscore)) / (COUNT(QA_Scores.score_total) + COUNT(qaform.qscore)
)
) AS avg_score
FROM QA_Scores
LEFT JOIN qaform ON QA_Scores.score_tech = qaform.emp_id
WHERE qaform.emp_id = XXXXXX

Now, it does work perfectly IF THERE ARE SCORES ON BOTH TABLES

but the problem I am having is that there may not be a score on one of the tables.. it could be one or the other

Any workarounds?

Thank you

Shawn
Okay, still new with all this union and joining

when I run that command it states

#1054 - Unknown column 's.score' in 'field list'

So what would I do to add s.score as a temp maybe?
You have made me the happiest man alive

1000 Thanks to you!

I hope you have a great year
 
Back
Top