一个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 ......
原帖子:http://topic.csdn.net/u/20090910/12/813a40a2-922d-4f6a-b30b-a16b9a608f81.html?seed=1336087098&r=59699368#r_59699368 下面的代码有错误吗?sql语句在Query中是可以执行出结果的。 Set C ......
各位大侠:请问怎样在ASP程序中调用SQL存储过程?谢谢,请给个例子! http://hi.baidu.com/lz0830/blog/item/e847e5e9077fde39b80e2db9.html 1 这也是最简单的方法,两个输入参数,无返回值: set con ......
自从直接在一个表里加了个字段(nvarchar 其他默认,不插入自己默认为 <null>)后,重启网站+sql server 2000 6-8个小时后出现问题:网站写数据库时脚本超时 Active Server Pages 错误 'ASP 0113 ......
import java.sql.*; public class Test { public static void main(String[] srg) { String driverName = "com.microsoft.sqlserver.jdbc.SQLServerDriver"; //加载JDBC ......