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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Update query with INNER JOIN 1

Status
Not open for further replies.

rwn

Technical User
Dec 14, 2002
420
US
This is the UPDATE Query Im trying to execute on the SQL Server, but it errors out on the INNER Join.

UPDATE Material_Location INNER JOIN Material ON Material_Location.Material = Material.Material SET Material_Location.On_Hand_Qty = 0
WHERE (((Material.Class)='Assy'));
 
You need to rearrange the code and add from
Code:
UPDATE M
SET Material_Location.On_Hand_Qty = 0
FROM Material_Location INNER JOIN Material ON Material_Location.Material = Material.Material  
WHERE (((Material.Class)='Assy'));

djj
The Lord is my shepherd (Psalm 23) - I need someone to lead me!
 
Sorry forgot the alias for Material_Location M

djj
The Lord is my shepherd (Psalm 23) - I need someone to lead me!
 
error results.

Msg 208, Level 16, State 1, Line 1
Invalid object name 'M'.
 
correct by:

UPDATE Material_Location
SET Material_Location.On_Hand_Qty = 0
FROM Material_Location INNER JOIN Material ON Material_Location.Material = Material.Material
WHERE (((Material.Class)='KFLEX'));
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top