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..

please show your table structure,so that i can help.

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..

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'
pixelsoul

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.