UNION Issue
Hello all, I was trying to do the following according to a website that discussed JOINS in MySQL:
SELECT user.name, course.name
FROM `user`
LEFT JOIN `course` on user.course = course.id
UNION
SELECT user.name, course.name
FROM `user`
RIGHT JOIN `course` on user.course = course.id;
When I run this query I get the response:
ERROR 1054 (42S22): Unknown column 'course.name' in 'field list'
If I enter each query separately then give me results. It's when I use UNION that I get that result. Does anyone know why? Basically the tutorial was just how to do a FULL OUTER JOIN, and said it had to be done this way.
Subject
Written By
Posted
UNION Issue
July 05, 2016 04:43PM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.