不行啊。update A a set a.dui_status=( select b.dui_status from B b, A a where b.dui_date=a.dui_date and b.acct_no=a.acct_no );报错:Error Code: -811
追答写错了
update A a set a.dui_status=( select b.dui_status from B b where b.dui_date=a.dui_date and b.acct_no=a.acct_no )
不需要在里面还声明一次表a
还是不行,亲。报同样的错误: [Error Code: -811, SQL State: 21000] DB2 SQL Error: SQLCODE=-811, SQLSTATE=21000, SQLERRMC=null, DRIVER=3.50.152
追答我知道为什么了,你这个子查询语句查询出来的结果不是唯一的,待修改的列匹配上了不止一个结果,所以导致报错。
追问对啊,就是这个错误。怎么搞呢,写个存储过程或function行吗?
追答那就只能用函数或存储过程实现了
追问函数该如何写啊?我写了个函数,但是执行结果是空的。求指教了啊
本回答被网友采纳