Getting an error when trying to create a view using a different table for the 'where' part This is what I tried:
Create view vw_OverAllocatedPM as
(
select
firstName, lastName, ssn
from Employee, ProjectDetails
where count(projectManager) > 6
)
I also tried:
Create view vw_OverAllocatedPM as
(
select
firstName, lastName, ssn
from Employee, ProjectDetails
having count(projectManager) > 6
)
The selected columns are from the employee table and the parameter column is FK from a diff table
Any help of info is greatly appreciated.
Never use commas in the FROM
clause. Always use proper, explicit JOIN
syntax.
I speculate that the query you want looks something like this:
select e.firstName, e.lastName, e.ssn
from Employee, ProjectDetails pd join
Employee e
on pd.projectManager = e.employeeid -- no idea what the real join keys are
group by e.firstName, e.lastName, e.ssn
having count(*) > 6;
It is rather hard to say what the query really is, because you don't show the table structures nor do you really clearly explain what you are trying to do.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.