The following is what I'm working on for one of my query joins, I'm trying to create a table where the general screening details and combined with movie details. I keep getting the error 1066. Can anyone help or elaborate as to why?
SELECT screening.ScreeningID, screening.MovieID, SeatCapacity, SeatsAvailable
FROM screening
LEFT JOIN movie
ON screening.ID = movie.ScreeningID
UNION
SELECT MovieName, Director, Genre
FROM movie
RIGHT JOIN movie
ON screening.ID = movie.ScreeningID;
UPDATE:
Thanks guys for the replies, I have been an absolute complete noob and over complicated things (as usual). After some more digging around, this is what I came up with which perfectly works. I was trying to output the seating availability in a screening in one table by combining data from multiple tables.
SELECT s1.ScreeningID, s1.MovieID, s1.SeatCapacity, s1.SeatsAvailable, m1.Director, m1.MovieName, m1.Genre
FROM screening s1, movie m1
WHERE m1.screeningID = s1.screeningID
You need to alias your tables and also each query that participates in the UNION must have the same number of columns.