nest a stored query...

jvargas

New Member
Joined
Nov 7, 2003
Messages
8
How do you reference as stored query in your SQL statements? Lets say im building a query that needs data from queryA results. Im guessing I would do something like this:

SELECT a, b, c FROM [tblA] WHERE b IN ([queryA].someField);

This doesnt work, the query is prompting me for a value of someField. I even tried to take out the ".someField" but still not working. What is the proper syntax for this?

Thanks :p
 

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
Somewhat confusing, but something like this should work:
  • SELECT a, b, c FROM [tblA] WHERE b IN (Select someField from queryA);
Hope this helps,

Russell
 
Upvote 0
Russell Hauf said:
Somewhat confusing, but something like this should work:
  • SELECT a, b, c FROM [tblA] WHERE b IN (Select someField from queryA);
Hope this helps,

Russell

Yeah, sorry.. i just realized that all i had to do was make a regular join and treat the query as a table.

Thanks :coffee:
 
Upvote 0

Forum statistics

Threads
1,221,574
Messages
6,160,602
Members
451,657
Latest member
Ang24

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top