I have tried to use temporary table to simplify my query but I am getting an error message.
Here is my query:
SELECT E.ID, E.name
INTO #TmpEmplyee
FROM Employee E, Outsourcing O, Student S
WHERE E.ID NOT IN (SELECT ID FROM Student UNION SELECT ID FROM Outsourcing)
SELECT R.name, I.startDate, T.name
FROM Role R, Inn I, #TmpEmplyee T
WHERE I.name = R.name AND I.ID = T.id
And the error is:
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'FROM Employee E, Outsourcing O, Student S WHERE E.ID NOT IN (SELECT ID FROM Stud' at line 3
Thanks for the help!
To create a temporary table from a select you should use this syntax