常见的SQL语句

1、select decode(a.xh,'','0','1')||decode(b.xh,'','0','1') from A a left join B b on a.xh=b.xh where a.xh='" + xh + "'

查找在xh是否在A、B中如在在返回1,不在返回0。

2、update  A set  bh=(select bh from  B  where B.id=  A.id) where id in (select id from  B)

更新A 、编号在B中而且在A中

3、insert into A (id,bh) select id,bh from B where id not in(select id from  A

更新A、编号在B中而且不再A中

原文地址:https://www.cnblogs.com/bindot/p/3177454.html