nest queries

  • Thread starter Thread starter Vsn
  • Start date Start date
V

Vsn

Dear All,

Could anyone tell me how I can 'nest' to queries in SQL code?

Thx,
Vsn
 
Can you be a bit more specific on what you want? Are you trying to do this in a
VBA routine? Or are you trying to do this in the query grid? Or ???

Also, please define what you mean by "nest". Perhaps a specific example of what
you want to do would help us to respond to your question.

Here are two variations of what you might mean by "nest".
Two separate already existing queries joined to each other in a third query.
SELECT *
FROM QueryA INNER JOIN QueryB
On QueryA.PrimaryKey = QueryB.RelatedField

A subquery to return a value within a the SELECT clause
SELECT SomeField,
(Select SUM(AnotherField) FROM Table2) as Total
FROM Table1

You could also have a subquery in the from clause and join that to a table or an
existing query.
 
John,

I mend the second solution you gave (i think), I would like to code (in SQL)
a query and than use it as sourse in a second query (instead of a table
beiing the sourse).

I hope I will manage with the second example you gave, otherwise I will
respond tomorrow.

Thx.
 

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

Back
Top