you lack FROM
clause
SELECT track_id
FROM tableName
WHERE track_title
so the full query would be
INSERT INTO People (Track_id_Reference)
SELECT track_id
FROM -- <<== add tableName here
WHERE track_title = (
SELECT tracktitle
FROM top100
WHERE artist = (
SELECT p.People_name,
t.artist
FROM People AS p
RIGHT JOIN top100 AS t
ON p.People_name = t.artist
UNION
DISTINCT
SELECT p.People_name,
t.artist
FROM People AS p
LEFT JOIN top100 AS t
ON p.People_name = t.artist
)
);
another problem that will arise soon is the use of equal =
sign on the result of the subquery, it is much safer to use IN
than =
because it will throw an exception if, for instance, the subquery will return more than one value. Example,
INSERT INTO People (Track_id_Reference)
SELECT track_id
FROM -- <<== add tableName here
WHERE track_title IN (
SELECT tracktitle
FROM top100 .............