您的位置:首页 > 数据库

常见的SQL语句

2013-07-08 11:45 120 查看
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中
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: