I am using sqlite3. When I run the following query it does not return any value. (It doesn't show any error either).
SELECT
term_id,
session_id,
student_id ,
total,
gpa,
grade_letter
FROM
(
SELECT
term_id,
session_id,
student_id ,
sum(overall_term_mark + overall_term_class_test_mark) AS total,
SUM(overall_term_gpa) AS gpa
FROM tbl_main_exam_details a
LEFT JOIN tbl_main_exam b ON b.main_exam_id = a.main_exam_id
WHERE session_id = 1 AND term_id = 1 AND class_id = 1
GROUP BY student_id
) k,
tbl_grading_system WHERE grade_point >= k.gpa AND grade_point <= k.gpa
But If I replace the last line of the code with the following code, then it gives me my desired result.
tbl_grading_system WHERE grade_point >= 4 AND grade_point <= 4
If I completely remove the last line of the code and don't select grade_letter from tbl_grading_system then all records show up perfectly including the gpa
So I think the query is selecting the gpa value but for some reason the last line of the code can't get the value of it and hence the query is not returning any result.
Could you please tell me where the mistake is ?
Thanks in advance.
Aucun commentaire:
Enregistrer un commentaire