Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/sql/67.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用SQL更新SAS中的表时无法重新打开错误_Sql_Sas - Fatal编程技术网

使用SQL更新SAS中的表时无法重新打开错误

使用SQL更新SAS中的表时无法重新打开错误,sql,sas,Sql,Sas,我有两张桌子: t1带列A、B、X、Y、Z和 t2带列A、B、N 我想将t1.A设置为valuet2.N,其中t1.A=t2.A和t1.B=t2.B 听起来很简单,但我不知道如何解决这个问题;我试过这样的方法: update t1 set A = (select t2.N from t1,t2 where t1.A = t2.A and t1.B = t2.B)

我有两张桌子:

  • t1
    带列
    A、B、X、Y、Z
  • t2
    带列
    A、B、N
我想将
t1.A
设置为value
t2.N
,其中
t1.A=t2.A和t1.B=t2.B

听起来很简单,但我不知道如何解决这个问题;我试过这样的方法:

update t1 set A = (select t2.N 
                     from t1,t2 
                    where t1.A = t2.A 
                      and t1.B = t2.B)
......
但这会产生一个错误:

ERROR: You cannot reopen t1.DATA for update access with member-level control because t1.DATA .....

有什么想法吗?

我想你只是想要一个相关的子查询:

update t1
    set A = (select t2.N 
             from t2 
             where t1.A = t2.A and t1.B = t2.B
            );

注意:您应该注意子查询只返回一行。

除了语法错误之外,还有一个旁注:您得到了
错误:您无法使用成员级控件打开用于输出访问的WORK.T1.DATA,因为您正在资源环境DATASTEP中使用WORK.T1.DATA。
因为您的输出数据集在窗户。重新运行之前,请关闭
视图表:Work.T1

我试图澄清一下这个问题。我很确定在运行之前我关闭了窗口,所以我认为这是SQL引擎的问题,不管怎样:谢谢你的提示。