[英]How do I get my UPDATE statement to function on ctree?
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.我已经完成了插入语句,但很难让我的 UPDATE 语句在 CTREEACE DATABASE 脚本部分工作。 If there is anybody familiar with ctree that could help please take a look and see if there is something wrong with my syntax.如果有人熟悉 ctree 可以提供帮助,请查看我的语法是否有问题。
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如果根据 tbl71 的行为视图中的日期存在地址,则更新来自 tbl71 的行为中的所有列
At the beginning check these 8 rules:一开始检查这8条规则:
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.下一个问题是 idk 为什么要尝试使用from (act) 从另一个视图(tbl71) 更新列,但这取决于您。
If this example doesn't work it's ok:如果这个例子不起作用,那没关系:
UPDATE act
SET act.address = tbl71 .address
FROM act
INNER JOIN tbl71 ON act.address = tbl71.address
WHERE dates = '7/31/2018'
Try to see the result of this simple query to see that union or join works:尝试查看这个简单查询的结果以查看联合或连接是否有效:
SELECT *
FROM act
INNER JOIN tbl71 ON act.address = tbl71.address
After this try to add *"Where":在此之后尝试添加 *"Where":
SELECT *
FROM act
INNER JOIN tbl71 ON act.address = tbl71.address
WHERE dates = '7/31/2018'
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.)最简单的方法是重新创建视图(创建 1 个视图而不是 2 个,这将获得您需要的最终数据。)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.