I have two tables DEPORTMENT and DEPORTMENT_VAL.
TABLE DEPORTMENT
idnumber | subjectcode | 1st Qtr | 2nd Qtr | 3rd Qtr | 4th Qtr
1 | CL 7D | A- | A+ | A | B+
1 | ENG 7D | A+ | A+ | A+ | B+
1 | MATH 7D | B+ | A- | A+ | B+
TABLE DEPORTMENT_VAL
Grade | Value
A+ | 1
A | 2
A- | 3
B+ | 4
What should I query so that I can show this view?
TABLE DEPORTMENT
idnumber | subjectcode | 1st Qtr | 2nd Qtr | 3rd Qtr | 4th Qtr
1 | CL 7D | 3 | 1 | 2 | 4
1 | ENG 7D | 1 | 1 | 1 | 4
1 | MATH 7D | 4 | 3 | 1 | 4
Update: I changed the DEPORTMENT table by quarters because I need to get the average of these grades per quarter after I get this view.
SELECT *
FROM DEPORTMENT
JOIN DEPORTMENT_VAL USING (Grade)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.