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

Problem with UPDATE statement

Status
Not open for further replies.

TomBarrand

Programmer
Joined
Aug 9, 2000
Messages
162
Location
GB
I have the following UPDATE statement and I am having problems with the where clause for it, any suggestions?

UPDATE Temp_FOBL
SET FOB_No =
(select FOB_No from FOB, Temp_FOB
where FOB.Purch_Ord_No = Temp_FOB.Purch_Ord_No AND FOB.FOBI_Line_No = Temp_FOB.FOBI_Line_No)
where FOB.Purch_Ord_No = Temp_FOB.Purch_Ord_No AND FOB.FOBI_Line_No = Temp_FOB.FOBI_Line_No

When I execute it through the query analyizer I get the following errors:

Server: Msg 107, Level 16, State 3, Line 1
The column prefix 'FOB' does not match with a table name or alias name used in the query.
Server: Msg 107, Level 16, State 1, Line 1
The column prefix 'Temp_FOB' does not match with a table name or alias name used in the query.
Server: Msg 107, Level 16, State 1, Line 1
The column prefix 'FOB' does not match with a table name or alias name used in the query.
Server: Msg 107, Level 16, State 1, Line 1
The column prefix 'Temp_FOB' does not match with a table name or alias name used in the query.
 
UPDATE Temp_FOBL
SET FOB_No = A.FOB_No
FROM FOB A, Temp_FOB B
WHERE A.Purch_Ord_No = B.Purch_Ord_No
AND A.FOBI_Line_No = B.FOBI_Line_No
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top