How to apply two inner joins within a single query

This is the query i run to fetch data from multiple tables —

SELECT qtq.c_ques_cat AS q_cat, qtq.c_point AS fuly_score, SUM( qrs.c_score ) AS us_score, L.qc_category AS q_category
FROM jos_quiz_r_student_question AS qrs
INNER JOIN jos_quiz_t_question AS qtq ON qrs.c_question_id = qtq.c_id
INNER JOIN jos_quiz_q_cat AS L ON L.qc_id = qtq.c_ques_cat
AND qrs.c_stu_quiz_id = '784'
AND qtq.published =1
GROUP BY q_cat
ORDER BY us_score
LIMIT 0 , 30

Advertisements

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s