SQL Query - Update code

Try this instead. BACKUP first. :-)


UPDATE SHIPTO
SET SHIPTO.TERRITORYID =
(SELECT TERRITORYID FROM CUSTOMER WHERE CUSTOMER.CUSTNUM = SHIPTO.CUSTNUM)







Vic Drecchio
ERP Administrator
TIMCO Aviation Services
Greensboro, NC
Email:Â Â vic.drecchio@...
Mobile:Â 704.530.3092

-----Original Message-----
From: vantage@yahoogroups.com [mailto:vantage@yahoogroups.com] On Behalf Of jendmp
Sent: Tuesday, October 06, 2009 12:34 PM
To: vantage@yahoogroups.com
Subject: [Vantage] SQL Query - Update code

I'm looking for the code to run an update of the ShipTo table. I am restructuring our Territories. I wrote an update to take care of the Customer.TerritoryID field. Now I need the code to update the Shipto.TerritoryID to match the Customer.TerritoryID.


I've tried several different codes but can't get it right. Obviously I'm not a SQL guru....

I'm guessing it would look something like this.

Update SHIPTO
set SHIPTO.TERRITORYID=CUSTOMER.TERRITORYID
where SHIPTO.CUSTNUM=CUSTOMER.CUSTNUM



------------------------------------

Useful links for the Yahoo!Groups Vantage Board are: ( Note: You must have already linked your email address to a yahoo id to enable access. )
(1) To access the Files Section of our Yahoo!Group for Report Builder and Crystal Reports and other 'goodies', please goto: http://groups.yahoo.com/group/vantage/files/.
(2) To search through old msg's goto: http://groups.yahoo.com/group/vantage/messages
(3) To view links to Vendors that provide Vantage services goto: http://groups.yahoo.com/group/vantage/linksYahoo! Groups Links
I'm looking for the code to run an update of the ShipTo table. I am restructuring our Territories. I wrote an update to take care of the Customer.TerritoryID field. Now I need the code to update the Shipto.TerritoryID to match the Customer.TerritoryID.

I've tried several different codes but can't get it right. Obviously I'm not a SQL guru....

I'm guessing it would look something like this.

Update SHIPTO
set SHIPTO.TERRITORYID=CUSTOMER.TERRITORYID
where SHIPTO.CUSTNUM=CUSTOMER.CUSTNUM