I have a program that I'm creating with PyQt4 and a backend database with SQLite. I'm trying to display a table. So I needed an Inner Join with my database. The code I have is:
c.execute("SELECT tblStudents.StudentID, tblStudents.Forename, tblStudents.Surname, tblTestType.Name, tblTests.Score, tblTests.AmountTried, tblTeachers.Initials FROM tblTestType INNER JOIN (tblTeachers INNER JOIN ((tblStudents INNER JOIN tblClasses ON tblStudents.StudentID = tblClasses.StudentID) INNER JOIN tblTests ON tblStudents.StudentID = tblTests.StudentID) ON tblTeachers.TeacherID = tblClasses.TeacherID) ON tblTestType.TypeID = tblTests.TypeID;")
data = c.fetchall()
print(data)
for i,row in enumerate(data):
for j,val in enumerate(row):
self.table.setItem(i, j, QtGui.QTableWidgetItem(str(val)))
And The error I get is:
sqlite3.OperationalError: no such column: tblStudents.StudentID
Please could you help me. If I haven't given enough information I can give you more. Thank you!
Aucun commentaire:
Enregistrer un commentaire