如何删除一个大表中含有的小表的数据. delete 表1 where exists(select 列1 from 表2) 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 delete 表1 where 列1 in(select 列1 from 表2) 楼主别给我分,我问问题呢?create database db_testgocreate table t_MaxTable( t_No tinyint not null identity(1,1), t_Title varchar(50) not null default '此处为大表主题' constraint PK_tTi primary key)goinsert into t_MaxTable (t_Title) values ('')insert into t_MaxTable (t_Title) values ('1此处为主题')insert into t_MaxTable (t_Title) values ('2此处为主题')insert into t_MaxTable (t_Title) values ('3此处为主题')insert into t_MaxTable (t_Title) values ('4此处为主题')select * from t_MinTablecreate table t_MinTable( t_No tinyint not null identity(3,1), t_Title varchar(50) not null)goinsert into t_MInTable (t_Title) values ('asdsadasd')insert into t_MInTable (t_Title) values ('asdasdsadasd')insert into t_MInTable (t_Title) values ('asdasadsd')insert into t_MInTable (t_Title) values ('asasasdsadasd')go--delete 表1 where 列1 in(select 列1 from 表2)delete t_MaxTable where t_No in (select t_No from t_MinTable )select * from t_MaxTable godrop table t_MaxTabledrop table t_MinTablegouse database mastergodrop database db_test-------------------------------我刚学SQL,我想问一下,(select t_No from t_MinTable ),select 不是表内查询吗?怎么可以用这样的语句呢?怎么可以用Select 表1 from 表2的字段呢? delete 表1 where 列1 in (select 列1 from 表2) 求sql语句,将多列转换成一行数据 嵌套查寻,出现错误"OPTIMIZER LOCK HINTS",csdn的朋友帮忙~! 有identity 列的表 , 在表的資料全部刪除後, 怎樣設置讓identity 列的值又從 1 開始? 表关联问题。 用SQL做个企业库存管理的数据库 跪求SQL的编写 JESSEZ\SQLEXPRESS无法登陆...为什么呢? 数据怎么导入啊.... sql一句话怎样写出来! 有关ISNULL的使用 求一条sql语句 sqlserver2000如何倒入excel2003?
gocreate table t_MaxTable
(
t_No tinyint not null identity(1,1),
t_Title varchar(50) not null default '此处为大表主题'
constraint PK_tTi primary key
)
goinsert into t_MaxTable (t_Title) values ('')
insert into t_MaxTable (t_Title) values ('1此处为主题')
insert into t_MaxTable (t_Title) values ('2此处为主题')
insert into t_MaxTable (t_Title) values ('3此处为主题')
insert into t_MaxTable (t_Title) values ('4此处为主题')select * from t_MinTablecreate table t_MinTable
(
t_No tinyint not null identity(3,1),
t_Title varchar(50) not null
)
goinsert into t_MInTable (t_Title) values ('asdsadasd')
insert into t_MInTable (t_Title) values ('asdasdsadasd')
insert into t_MInTable (t_Title) values ('asdasadsd')
insert into t_MInTable (t_Title) values ('asasasdsadasd')
go
--delete 表1 where 列1 in(select 列1 from 表2)delete t_MaxTable where t_No in (select t_No from t_MinTable )select * from t_MaxTable
godrop table t_MaxTable
drop table t_MinTable
gouse database master
godrop database db_test-------------------------------
我刚学SQL,我想问一下,(select t_No from t_MinTable ),select 不是表内查询吗?怎么可以用这样的语句呢?怎么可以用Select 表1 from 表2的字段呢?