一个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 ......
我是这样写的 select top 5 * from city where id not in(select top (5*"&page-1&") id from city) .. 很失败的 还要先判断是不是第一页 然后选择性执行 sql .. 写着写着我 ......
自从直接在一个表里加了个字段(varchar 其他默认,不插入自己默认为 <null>)后,重启网站+sql server 2000 6-8个小时后出现问题:网站写数据库时脚本超时 Active Server Pages 错误 'ASP 0113' ......
错误信息: Microsoft OLE DB Provider for ODBC Drivers (0x80004005) [Microsoft][ODBC SQL Server Driver][Shared Memory]无效的连接。 /bbsxp/test.asp, 第 24 行 机器配置:xp sp3 ,SQL 2005(vs ......
import java.sql.*; public class Test { public static void main(String[] srg) { String driverName = "com.microsoft.sqlserver.jdbc.SQLServerDriver"; //加载JDBC ......