易截截图软件、单文件、免安装、纯绿色、仅160KB

一个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)

高手,谢谢了。


相关问答:

sql+asp多表查询问题???

A商品表
ma  spmc    ppbm   
 
B 品牌表
ppbm  ppmc    jyb


C销售表
xrq  ma  xsl  xje    ppbm  jy ......

关于ASP利用SQL语句技巧分页效果

我是这样写的

select top 5 * from city where id not in(select top (5*"&page-1&") id from city) ..

很失败的  还要先判断是不是第一页 然后选择性执行 sql .. 写着写着我 ......

sql server 2000 +asp网站7个小时后出问题

自从直接在一个表里加了个字段(varchar 其他默认,不插入自己默认为 <null>)后,重启网站+sql server 2000 6-8个小时后出现问题:网站写数据库时脚本超时

Active Server Pages 错误 'ASP 0113' ......

asp连接SQL2005 出现 无效的连接(0x80004005) 错误!

错误信息:
Microsoft OLE DB Provider for ODBC Drivers (0x80004005)
[Microsoft][ODBC SQL Server Driver][Shared Memory]无效的连接。
/bbsxp/test.asp, 第 24 行

机器配置:xp sp3 ,SQL 2005(vs ......

java连接sql 2005问题 在线等。。。。


import java.sql.*;

public class Test {
public static void main(String[] srg) {
  String driverName = "com.microsoft.sqlserver.jdbc.SQLServerDriver";  //加载JDBC ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号