0

mysql Inner join problem

I have written a mysql query-
SELECT questions.id,questions.date,questions.title,users.user_name,subjects.subject FROM questions INNER JOIN topics ON questions.topic_id=topics.id INNER JOIN subjects topics.subject_id=subjects.id INNER JOIN users ON subjects.id=users.sub1 OR subjects.id=users.sub2 WHERE users.id=8;
which is giving error-
1066 - Not unique table/alias: 'topics' .i am unable to understand the problem.

2
Contributors
1
Reply
4
Views
5 Years
Discussion Span
Last Post by urtrivedi
0

You are missing ON keyword after inner join subjects

SELECT questions.id,questions.date,questions.title,users.user_name,subjects.subject FROM questions INNER JOIN topics ON questions.topic_id=topics.id INNER JOIN subjects ON topics.subject_id=subjects.id INNER JOIN users ON subjects.id=users.sub1 OR subjects.id=users.sub2 WHERE users.id=8;

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.