0

This is my SQL statement..

SQL Statement: SELECT tbl_subjectsenrolled.SubjectID, tbl_subject.SubjectDesc, studentsubjectgrade.Finals
FROM tbl_subject
INNER JOIN tbl_subjectsenrolled
ON tbl_subject.SubjectID=tbl_subjectsenrolled.SubjectID
INNER JOIN studentsubjectgrade
ON tbl_subjectsenrolled.SubjectID=studentsubjectgrade.subjectID
WHERE studentsubjectgrade.StudentID='04-0044'

But the OUTPUT is this:

SubjectID1 SubjectDesc1 Finals1
SubjectID1 SubjectDesc1 Finals1
SubjectID2 SubjectDesc2 Finals2
SubjectID2 SubjectDesc2 Finals2

Instead of this:
SubjectID1 SubjectDesc1 Finals1
SubjectID2 SubjectDesc2 Finals2

What is wrong with my SQL statement? Pls help..

3
Contributors
4
Replies
36
Views
4 Years
Discussion Span
Last Post by janskey15
0

tbl_subject - SubjectCode(PK), SubjectDesc, Units
tbl_subjectsenrolled - ID(PK)(auto increment), StudentID, Academicyr, Semester
register - StudentID(PK), Fullname, password, EmailAdd, Address
studentsubjectgrade - GradeID(PK), SubjectOfferingID, SubjectCode, StudentID, Finals, Remarks

IIM

Those are the structures in my tables..

0

Try:

SELECT DISTINCT(tbl_subjectsenrolled.SubjectID), tbl_subject.SubjectDesc, studentsubjectgrade.Finals
FROM tbl_subject
INNER JOIN tbl_subjectsenrolled
ON tbl_subject.SubjectID=tbl_subjectsenrolled.SubjectID
INNER JOIN studentsubjectgrade
ON tbl_subjectsenrolled.SubjectID=studentsubjectgrade.subjectID
WHERE studentsubjectgrade.StudentID='04-0044'
0

pixelsoul

Thanks for the help..I solved it using your SQL statement.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.