select a.pk2,c.a,d.b,a.d from t2 a , t3 b,t1 c,t1 d where a.pk2=b.pk2 and b.pk1=c.pk1 and a.pk2=b.pk2 and b.pk1=d.pk1
update t2 set a=t1.a,b=t1.b from t2 where exists(select * from t1,t3 where t2.pk2=t3.pk2 and t3.pk1=t1.pk1)
select t2.pk2,t1.a,t1.b,t1.c from t2 join t3 on t2.pk2=t3.pk2 join t1 on t3.pk1=t1.pk1
或: select t2.pk2,t1.a,t1.b,t1.c from t2,t3,t1 where t2.pk2=t3.pk2 and t3.pk1=t1.pk1
哈哈。。上面跟着你的题目错了是这样的:select t2.pk2,t1.a,t1.b,t2.c from t2 join t3 on t2.pk2=t3.pk2 join t1 on t3.pk1=t1.pk1或:select t2.pk2,t1.a,t1.b,t2.c from t2,t3,t1 where t2.pk2=t3.pk2 and t3.pk1=t1.pk1
晕~select t2.pk2,t1.a,t1.b,t2.d from t2 join t3 on t2.pk2=t3.pk2 join t1 on t3.pk1=t1.pk1 或: select t2.pk2,t1.a,t1.b,t2.d from t2,t3,t1 where t2.pk2=t3.pk2 and t3.pk1=t1.pk1
from t2 a , t3 b,t1 c,t1 d
where a.pk2=b.pk2 and b.pk1=c.pk1
and a.pk2=b.pk2 and b.pk1=d.pk1
set a=t1.a,b=t1.b
from t2
where exists(select * from t1,t3 where t2.pk2=t3.pk2 and t3.pk1=t1.pk1)
select t2.pk2,t1.a,t1.b,t1.c from t2,t3,t1 where t2.pk2=t3.pk2 and t3.pk1=t1.pk1
或:
select t2.pk2,t1.a,t1.b,t2.d from t2,t3,t1 where t2.pk2=t3.pk2 and t3.pk1=t1.pk1
不知道是我说错了还是怎么的,我是要更新(update)t2的不是检索(select)
55555555555555
(select t1.a,t1.b,t3.pk2 from t1 inner join t3 on t1.pk1=t3.pk1) tmp where t2.pk2=tmp.pk2