嗨,我想更新空白表格中的最后一列。图为输入和所需输出。试图选择工作顺序和状态匹配的最大日期。
我尝试过几个不同的代码:
UPDATE mytable
SET mytable.orderstartdate = MAX(table2.earliestdate)
FROM mytable as table2
WHERE (mytable.workorder = table2.workorder AND
mytable.state = table2.state)
;
查询表达式'MAX(table2.earliestdate)FROM mytable as table2'中的语法错误(缺少运算符)。“
UPDATE mytable
SET mytable.orderstartdate = (
SELECT max(earliestdate)
FROM mytable as table2
WHERE (mytable.workorder = table2.workorder AND
mytable.state = table2.state)
)
;
“操作必须使用可更新的查询”
编辑 - 点击表格链接图片。
答案 0 :(得分:0)
编写PL / SQL代码。
答案 1 :(得分:0)
UPDATE table A
SET A.orderstartDate = (SELECT max(earliestdate)
FROM table B
WHERE A.WorkOrder = B.WorkOrder
GROUP BY WorkOrder)
不确定访问是否支持相关子查询,但如果确实如此...
如果没有......
UPDATE table A
INNER JOIN (SELECT WorkOrder, max(OrderStartDate) MOSD
FROM Table B
GROUP BY WorkOrder) C
ON A.WorkOrder = C.workOrder
SET A.OrderStartDate = C.MOSD
答案 2 :(得分:0)
检查数据库打开模式,可能会被锁定以进行编辑,或者您可能无权提交文件。