Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

use query results in new query

Status
Not open for further replies.

realik

Programmer
Joined
Mar 1, 2002
Messages
2
Location
US
I have several tables (Interfaces, Circuits) which contain information such as (Interfaces.ID, Interfaces.Rate, Interfaces.Region) and (Circuits.CircuitID, Circuits.IntA, Circuits.IntB, Circuits.Speed) where Circuits.IntA = Interfaces.ID and relates to an entry and Circuits.IntB = Interfaces.ID and relates to an entry. Essentially there are 2 entries in Interfaces for every CircuitID - an IntA and IntB.

Problem: How do I search where I can put in a Region and pull all results listed as such:

Region(1)

CircuitID, Speed
Circuits.IntA Interfaces.Rate Interfaces.Region(1)
Circuits.IntB Interfaces.Rate Interfaces.Region(x)

Essentially, I need to use a value from a query result to perform a second query.

THANK YOU!!!!
 
you want to use subquery construction:

SELECT tableOne.ID, tableOne.field, tableTwo.ID
FROM tableOne, tableTwo
WHERE tableOne.ID = tableTwo.ID AND tableOne.field = (SELECT somefield FROM tablename WHERE condition) Sylvano
dsylvano@hotmail.com
 
query1
select blah from table

query2
select blah2 from table2 where blah1 = query1.blahid
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top