我有两张桌子:
Cantentry
Dmelementnvp
dmelementnvp
有以下数据:
create table dmelementnvp (dmelement_id integer,name varchar(60),value varchar(60) not null)
insert into dmelementnvp values(1,'catlogEntryList',123)
insert into dmelementnvp values(1,'catlogEntryList',124)
insert into dmelementnvp values(1,'catlogEntryList',125)
Catentry
有以下数据:
create table catentry (catentry_id integer,member_id integer,idenifier varchar(60))
insert into catentry values(124,200,'yyy')
insert into catentry values(125,200,'zzz')
insert into catentry values(127,700,'yyy')
insert into catentry values(128,700,'zzz')
现在我需要使用
更新dmelementnvp
的值字段
127
128
而不是
124
125
和123应该保持不变..
我尝试了这个查询:
update DMELEMENTNVP
set value = (select catentry_id
from catentry
where catentry.idenifier = (select idenifier
from catentry
where CAST(catentry_id AS VARCHAR(50)) = DMELEMENTNVP.value)
and catentry.member_id = 700) where exists ( select 1 from catentry where catentry.catentry_id = DMELEMENTNVP.value )
我收到此错误
错误:DB2 SQL错误:SQLCODE = -407,SQLSTATE = 23502,SQLERRMC = TBSPACEID = 2,TABLEID = 513,COLNO = 1,DRIVER = 4.3.111 SQLState:23502 ErrorCode:-407
有人可以帮我摆脱这个吗??