现有两个表有相同字段tel,表里tel有不相同部分。两个表的 tel数据类型均为char类型且都允许置空,用命令select * from A where tel in(select tel from B)有结果,但用select * from A where tel not in(select tel from B)结果总是为空,不知道是什么原因???
解决方案 »
- MSSQL2000行转列
- SQL Server 2000系統日志問題
- 妹的 MS SQL Server 2000 你到底有多么不喜欢刷新!
- from a ,b or from a left join b 在update 的from 后 有区别马?
- SQL语句高手过来领分:如何用case语句来完成此项查询(只1个表)?有兴趣的也可以进来试试!
- 如何格式化字符串的问题?
- 请问两个表的更新比较的SQL语句是什么?
- 百思不得其解(sql server系统变量@@rowcount很奇怪的现象)
- 关于视图的一些问题
- 导入数据同步问题
- 求查询出来的数据只保留两位小数的语句
- “生成SQL脚本”功能只能生成表结构吗,能否为表中的记录生成Insert语句
----------------------------------------------------------------------
使用in(子查询)时要注意在子查询中加上where colx is not null这个条件,例如:
select tel from B where tel is not null
insert into aa select 1,100
insert into aa select 2,20
insert into aa select 3,89
insert into aa select 4,90
insert into aa select null,80create table bb (id int ,kc varchar(20))insert into bb select 1,'sx'
insert into bb select 2,'yw'
insert into bb select 2,'sx'
insert into bb select 1,'yw'
insert into bb select null,'sx'
select * from aa a where not exists (select * from bb b where a.id = b.id)
今天跟我们老师学的,不知道这么写对不对。呵呵!在苦难中前进!在艰难中成长!
学习中!