| Oracle FAQ | Your Portal to the Oracle Knowledge Grid | |
Home -> Community -> Usenet -> comp.databases.theory -> Re: Join or Cross Product
John Gilson wrote:
> Hope this helps.
It does, cheers.
How do you use a nested query in SQL? (the schema is the same as in my first post).
SELECT P.Number
FROM Project AS P
WHERE P.Name = 'ProductX'
AND P.ControllingDept = 5
I want to use that to get the employees who work in that department, but can't seem to get it right.
I tried
SELECT *
FROM WorksOn as W
WHERE W.Proj IN
(SELECT P.Number
FROM Project AS P
WHERE P.Name = 'ProductX'
AND P.ControllingDept = 5);
but that gives this rather unhelpful error in MySQL...
ERROR 1064: You have an error in your SQL syntax near '(SELECT P.Number
FROM Project AS P
WHERE P.Name = 'ProductX'
AND P' at line 3
Chris
-- for personal replies change 'spamoff' to 'chris'Received on Sun Aug 25 2002 - 12:38:38 CDT
![]() |
![]() |