update table2 t2 set fuser=(select fuser from (select fuser from table1 t1 where trim(t2.no)=t1.no order by fid desc ) t where rownum=1) where fuser is null
试了一下,会报错 ORA-00904: "T2"."NO": 无效的标识符
UPDATE TABLE2 T2 SET FUSER=(SELECT max(FUSER) FROM TABLE1 T1 WHERE TRIM(T2.NO)=T1.NO)
update table2 t2 set t2.fuser=(select fuser from (select no,fuser from (select no ,fuser,fid,max(fid) over(partition by no) dd from table1 t1) aa where aa.dd=fid) b where trim(b.no)=a.no and rownum=1)
over(partition by no) 这句是什么意思,能否解释一下,书上都没有
select no ,fuser,fid,max(fid) over(partition by no) dd from table1 t1 就是对表table1 中的每一条记录添加一个字段,这个字段是根据no编号分组后去每组的最大值的得来的,你可以将这条语句单独执行一下,看看效果就明白了!
set fuser=(select fuser from (select fuser from table1 t1
where trim(t2.no)=t1.no order by fid desc ) t where rownum=1)
where fuser is null
ORA-00904: "T2"."NO": 无效的标识符
这句是什么意思,能否解释一下,书上都没有
就是对表table1 中的每一条记录添加一个字段,这个字段是根据no编号分组后去每组的最大值的得来的,你可以将这条语句单独执行一下,看看效果就明白了!