表1
字段:id a1 a2 a3
1 ll ll ll
2 hh hh hh表2
字段:id f1 f2
1 j d
1 k dd
1 l fd
2 j fn
2 k fe表1与表2通过id相联,表1主键id,表2主键为f2
把a1的内容更新到f1
结果
字段:id f1 f2
1 ll d
1 ll dd
1 ll f
2 hh f
2 hh f
要求只写sql,这个该怎么写
哎,小弟我才注册没分了,恳请帮助啊
字段:id a1 a2 a3
1 ll ll ll
2 hh hh hh表2
字段:id f1 f2
1 j d
1 k dd
1 l fd
2 j fn
2 k fe表1与表2通过id相联,表1主键id,表2主键为f2
把a1的内容更新到f1
结果
字段:id f1 f2
1 ll d
1 ll dd
1 ll f
2 hh f
2 hh f
要求只写sql,这个该怎么写
哎,小弟我才注册没分了,恳请帮助啊
where exists (select 1 from table1 b where b.id=a.id);
update testaa,testcc
set testaa.name1 = testcc.mingcheng
where testcc.bianhao in (select distinct testcc.bianhao
from testaa,testcc
where testcc.bianhao = testaa.id1)
为什么会有错?报miss keyword?要怎么改?
update testaa
set name1=(select mingcheng from testcc where rownum=1 and bianhao=testaa.id1)
where exists(select 1 from testcc where bianhao=testaa.id1)