I have 2 working queries which both work fine on their own but when i join them together it causes an error
What it is supposed to do is select the childrens names whose parents woek in the Presonnel department
This is the joined query that causes the problem
Quote:
SELECT chd.name, chdn.ssn as ssn
FROM Child chd
INNER JOIN Children chdn ON chdn.name = chd.name
INNER JOIN Employee e ON chdn.ssn = e.ssn
WHERE chdn.ssn IN (SELECT Employee.ssn, d.dname
FROM Employee
INNER JOIN Works w ON w.ssn = Employee.ssn
INNER JOIN Department d ON d.dno = w.dno
WHERE d.dname = 'Personnel');
|
This is the first query that finds the people who works in the Personnel department and it works
Quote:
SELECT Employee.ssn, d.dname
FROM Employee
INNER JOIN Works w ON w.ssn = Employee.ssn
INNER JOIN Department d ON d.dno = w.dno
WHERE d.dname = 'Personnel';
|
and the query that lists the childrens name by an employee
Quote:
SELECT chd.name, chdn.ssn as ssn
FROM Child chd
INNER JOIN Children chdn ON chdn.name = chd.name
INNER JOIN Employee e ON chdn.ssn = e.ssn
WHERE chdn.ssn = 10254;
|
i wanto to replace the chdn.ssn with the other query like i tried above but it's throwing up and error at the second select statement