I have an SQL query that looks as follows:
SELECT
a.id user_id, a.type, a.email_address,
a.name_first, a.name_last, languages.title as language,
b.created_at purchased_on, b.expires_at watchable_until,
c.title,
d.title topic,
e.title category,
f.subject, f.grade
FROM users a,
user_video_purchases b,
videos c,
gradesubject_category_topics d,
gradesubject_categories e,
gradesubjects f
JOIN languages ON
users.language_preferred_id = languages.id
WHERE a.id = b.user_id
AND b.video_id = c.id
AND c.gradesubject_category_topic_id = d.id
AND d.gradesubject_category_id = e.id
AND e.gradesubject_id = f.id
ORDER BY purchased_on DESC;
This query returns the follow error message:
Unknown column 'users.language_preferred_id' in 'on clause'
The columns exists in the users
table and as far as I know the JOIN
is correct.
Can someone please point out where I might be going wrong?