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!

Select SQL WHERE table.field in (from list of values in table)?

Status
Not open for further replies.

MikeMV

MIS
Joined
May 15, 2006
Messages
131
Location
US
I am wondering if it is possible to use the values in a FoxPro table as the list for a where field in () criteria?

In my case I have 2 tables as follows:

InvMaster.StockCode

InvStructure.Parent
InvStructure.Child

I would like to setup something like:

AS Select InvStructure.Parent, InvStructure.Child from InvStructure;

WHERE InvStructure.Parent in (InvMaster.Stockcode)

Is this doable?

I will greatly appreciate your response.

 
yes, this way:

...Where InvStructure.Parent IN (Select InvMaster.StockCode From InvMaster)

but I'd rather do an inner join of the table, even if you don't want to select anything from InvMaster, an inner join is an existance check.

... FROM InvStructure Inner Join InvMaster On InvStructure.Parent = InvMaster.Stockcode

Bye, Olaf.
 
Thanks Olaf.

I'll try it as an inner join.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top