When trying to use view to find information regarding tables in my database, I cannot seem to be able to use my view in a select statement.
CREATE VIEW Num_projects AS SELECT ENumber, COUNT(*) AS Projects FROM WorksOn Group BY ENumber;
SELECT * FROM Num_projects;
CREATE VIEW Same_num_projects AS SELECT Employee.ENumber, Name FROM Employee JOIN Num_Projects WHERE Projects IN( SELECT Projects FROM Num_projects WHERE ENumber = 00101);
SELECT * FROM Same_num_projects;
This is the output from processing the above code:
--------------
CREATE VIEW Same_num_projects AS SELECT Employee.ENumber, Name FROM Employee JOIN Num_Projects WHERE Projects IN( SELECT Projects FROM Num_projects WHERE ENumber = 00101)
--------------
ERROR 1146 (42S02): Table 'csit115.Num_Projects' doesn't exist
--------------
SELECT * FROM Same_num_projects
--------------
ERROR 1146 (42S02): Table 'csit115.Same_num_projects' doesn't exist
--------------
Why isn't my view being recognised?