sql question - TechRepublic
General discussion
July 9, 2012 at 05:58 AM
aygul_salahli

sql question

by aygul_salahli . Updated 13 years, 12 months ago

hello.please help me. i want the students each mark count list for their given marks.but when i write the code like this G and B are taken the same.thanx in advance.

SELECT A.ID,A.NAME,A.SURNAME,COUNT(B.MARK_ID) AS “1”,COUNT(G.MARK_ID) AS “2”
FROM
STUDENTS_MARKS B,STUDENTS A LEFT JOIN STUDENTS_MARKS G
ON G.STUDENT_ID=A.ID

WHERE B.MARK_ID=1 AND A.ID=B.STUDENT_ID AND G.MARK_ID=2
GROUP BY A.ID, A.NAME,A.SURNAME ;

This discussion is locked

All Comments