I have a problem querying multiple tables in MySQL and am currently at my wits end.
I have unique IDs in each table, and am using an INNER JOIN to combine them; I am quite new to SQL and this may be the wrong method, hence me posting here:
Query:
SELECT res.UserID, res.QuizID, res.QuizResult, u.UserID, u.UserLogin, q.QuizID, q.QuizName, q.QuizFile FROM results res INNER JOIN users u ON (res.UserID = u.UserID) INNER JOIN quiz q ON (res.QuizID = q.QuizID)
Table users contains
UserID UserLogin UserPass
Table quiz contains
QuizID QuizName QuizFile
Table results contains
UserID QuizID QuizResults
Can anybody please tell me why I am getting a cartesian product, and how I should go about fixing it?
Try this:
A different way to realize something like an INNER JOIN is this:+