So I am writing a script that both inserts and updates based on a certain condition. I have the insert statement finished but having a hard time trying get my UPDATE statement to work in CTREEACE DATABASE script section. If there is anybody familiar with ctree that could help please take a look and see if there is something wrong with my syntax.
UPDATE act
SET tbl71.address = act.address
FROM act
INNER JOIN tbl71 ON act.address = tbl71.address
WHERE dates = '7/31/2018'
act view
----------
trackingid(varchar)
delivery_time(varchar)
state(varchar)
address(varchar)
city(varcahr)
zipcode(varchar)
dates(varchar)
tbl71 view
----------
trackingid(varchar)
delivery_time(varchar)
state(varchar)
address(varchar)
city(varcahr)
zipcode(varchar)
dates(varchar)
If an address exists based upon dates within the act view from tbl71 then update all columns in act from tbl71
At the beginning check these 8 rules:
Next one problem is that idk why are you trying to update column from another view (tbl71) using from (act),but it's up to you.
If this example doesn't work it's ok:
Try to see the result of this simple query to see that union or join works:
After this try to add *"Where":
And finally try to get in update. The easiest way can be to recreate a views (make a 1 view instead of 2, that will get the final data that you need.)