Subqueries

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
 
K

Ken Sheridan

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top