update a set a.a=(select b.a from b where a.a=b.a and a.b=b.b) , a.b=(select b.b from b where a.a=b.a and a.b=b.b) , a.c=(select decode(a.c >b.c,1,a.c,b.c) as c from b where a.a=b.a and a.b=b.b) , a.d=(select b.d from b where a.a=b.a and a.b=b.b) 但是我不知道怎么比较两个数的大小
update a set a.a=(select b.a from b where a.a=b.a and a.b=b.b) , a.b=(select b.b from b where a.a=b.a and a.b=b.b) , a.c=(select decode(sign(a.c>b.c),1,a.c,-1,b.c) as c from b where a.a=b.a and a.b=b.b) , a.d=(select b.d from b where a.a=b.a and a.b=b.b) 学习楼上的,哈哈
想不通,你们怎么不这样: update a set a.a= b.a a.b=b.b a.c=(select decode(a.c >b.c,1,a.c,b.c) as c from b where a.a=b.a and a.b=b.b), a.d=b.d where a.a=b.a and a.b=b.b这样效率不是更高
需要吧case语句换成decode(sign(a.c-b.c),...)
a.b=(select b.b from b where a.a=b.a and a.b=b.b) ,
a.c=(select decode(a.c >b.c,1,a.c,b.c) as c from b where a.a=b.a and a.b=b.b) ,
a.d=(select b.d from b where a.a=b.a and a.b=b.b)
但是我不知道怎么比较两个数的大小
a.b=(select b.b from b where a.a=b.a and a.b=b.b) ,
a.c=(select decode(sign(a.c>b.c),1,a.c,-1,b.c) as c from b where a.a=b.a and a.b=b.b) ,
a.d=(select b.d from b where a.a=b.a and a.b=b.b)
学习楼上的,哈哈
不过这好像是vb里面的,不知道sql里有没这样的函数阿
update a set a.a= b.a
a.b=b.b
a.c=(select decode(a.c >b.c,1,a.c,b.c) as c from b where a.a=b.a and a.b=b.b),
a.d=b.d
where a.a=b.a and a.b=b.b这样效率不是更高