一个SQL语句的问题。高手帮帮忙
有两个表。分别都有ID主键。A表的ID和B表的ID是对应的,就是A表几个ID,B表就几个ID。A表的ID是什么,B表的ID就是什么。 可是现在A表的ID比B表的多了。 我现在想要把B表中少的部分给补齐了。这个插入应该怎么写啊?
SQL code: insert into B(ID) select id from a where id not in (select id from b)引用 SQL codeinsertinto B(ID)select idfrom awhere idnotin (select idfrom b) 高手,谢谢了。
相关问答:
A商品表 ma spmc ppbm B 品牌表 ppbm ppmc jyb C销售表 xrq ma xsl xje ppbm jy ......
....接到一个小程序..工作原来大概是这样的...前台是WEB服务器.架构就是ASP+SQL..前台由ASP向SQL添加服务类别(表单).然后又后台程序读取表单..要实时读取..然后显示在服务器上面..从理论上面能行通不?如果可以..后台 ......
我安装SQL SERVER2008的时候选择WINDOWS身份验证连接的,我不知道怎么写连接。。。 还有我想改成SQL SERVER身份验证怎么改?? 谢谢大家了! XML code: <configuration> <appSettings> & ......
StringBuffer str = new StringBuffer("select * from menu where parentid=1 and mid <>1 order by parentid"); List list = new ArrayList(); ResultSet rst = null; DataBa ......
有三个表一个是采购单格式如下 入库单表: 入库单号 产品 质检编号 入库数量 001 品种1&n ......