SQL 开发人员在尝试更新 table 时出错
Error in SQL Developer when trying to update table
我想更新 table skuxloc 数量以等于 lotxlocxid 中每个 sku 的数量总和,如下所示:
update skuxloc sl
set sl.qty = lli.sumqty
inner join
(
select sku, sum(qty) sumqty
from lotxlocxid
where loc = 'DRSLN7STG'
group by sku
) lli on lli.sku = sl.sku
where sl.sku in
('108720-419-S',
'108720-419-XS',
'876070-100-11',
'876070-100-12',
'876070-100-9.5',
'942836-100-10.5',
'942836-100-6.5',
'942837-100-6.5',
'CW5594-100-6',
'CW5594-100-6.5',
'CW5594-100-8',
'DD1583-402-M',
'942836-100-9');
我在第 2 行收到错误消息,提示此 SQL 命令未正确结束。
知道我可能做错了什么吗?
Oracle 不支持 join
更新。而是使用相关子查询:
update skuxloc sl
set sl.qty = (select sum(lli.qty)
from lotxlocxid lli
where loc = 'DRSLN7STG' and
lli.sku = sl.sku
)
where sl.sku in
('108720-419-S',
'108720-419-XS',
'876070-100-11',
'876070-100-12',
'876070-100-9.5',
'942836-100-10.5',
'942836-100-6.5',
'942837-100-6.5',
'CW5594-100-6',
'CW5594-100-6.5',
'CW5594-100-8',
'DD1583-402-M',
'942836-100-9');
我想更新 table skuxloc 数量以等于 lotxlocxid 中每个 sku 的数量总和,如下所示:
update skuxloc sl
set sl.qty = lli.sumqty
inner join
(
select sku, sum(qty) sumqty
from lotxlocxid
where loc = 'DRSLN7STG'
group by sku
) lli on lli.sku = sl.sku
where sl.sku in
('108720-419-S',
'108720-419-XS',
'876070-100-11',
'876070-100-12',
'876070-100-9.5',
'942836-100-10.5',
'942836-100-6.5',
'942837-100-6.5',
'CW5594-100-6',
'CW5594-100-6.5',
'CW5594-100-8',
'DD1583-402-M',
'942836-100-9');
我在第 2 行收到错误消息,提示此 SQL 命令未正确结束。
知道我可能做错了什么吗?
Oracle 不支持 join
更新。而是使用相关子查询:
update skuxloc sl
set sl.qty = (select sum(lli.qty)
from lotxlocxid lli
where loc = 'DRSLN7STG' and
lli.sku = sl.sku
)
where sl.sku in
('108720-419-S',
'108720-419-XS',
'876070-100-11',
'876070-100-12',
'876070-100-9.5',
'942836-100-10.5',
'942836-100-6.5',
'942837-100-6.5',
'CW5594-100-6',
'CW5594-100-6.5',
'CW5594-100-8',
'DD1583-402-M',
'942836-100-9');