Subqueries

  • Thread starter Thread starter ram
  • Start date Start date
R

ram

HI to All,

I have a general question about subqueries- Is it possible to refer to a
query in the subquery or does it have to be a table. When I use a query in
the sub query I receive error message 3070- “The Microsoft Jet database
engine does not recognize <name> as a valid field name or expressionâ€. When I
change the query to a table, it works fine.

Thanks for any help with this question

Ramone
 
Ramone:

There's no reason why you can't refer to a query in a subquery, e.g.

SELECT *
FROM SomeTable
WHERE EXISTS
(SELECT *
FROM SomeQuery
WHERE SomeQuery.SomeColumn = SomeTable.SomeColumn);

Make sure that in the subquery you refer to the actual names of the column
or columns returned by the query which you are referencing in the subquery.
These may differ from the names of the columns in the table(s) on which the
query is based.

Ken Sheridan
Stafford, England
 
Back
Top