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!

format for SQL where statement 1

Status
Not open for further replies.

Xzibit7

Technical User
Joined
Jun 20, 2006
Messages
172
Location
US
I'm trying to do an SQL where statement that gets compares stock numbers created by a passthru query with the numbers already in my access database.

Is this the correct format for the Where statement

where National_stock_Number = [queries]![NSN]![NSN]
 
Perhaps this ?
WHERE National_stock_Number IN (SELECT NSN FROM NSN)

Or perhaps simply a JOIN ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
This is my first time using SQL here is my code so far


select

National_Stock_Number, Acquisition_Method_Code, Acquisition_Method_Suffix_Code, Annual_Demand_Value, Total_On_Hand_Qty, Acquisition_Cost, Total_Quantity_On_Backorder, critical_item_code

from DSS_USER.C_FILE


WHERE National_stock_Number = IN (SELECT NSN FROM NSN)



how would a JOIN work. I cant seem to get the join statement to work
 
I didn't post any = sign in my first suggestion.

As for the join:
SELECT National_Stock_Number, Acquisition_Method_Code, Acquisition_Method_Suffix_Code, Annual_Demand_Value, Total_On_Hand_Qty, Acquisition_Cost, Total_Quantity_On_Backorder, critical_item_code
FROM DSS_USER.C_FILE INNER JOIN NSN ON National_stock_Number = NSN.NSN


Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Ok I think my problem is the query cant find the query NSN.NSN although it is in the current database. The passthru query is getting its data from a large database on the network. Would I have to add a (queries.) at the beginning. It is more a question of how to let SQL know I am referring to the data in the query NSN, I am unsure of the format fo this.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top