比如表A有个字段name表B,表C都有和A相同的字段name现在想判断A的这个字段name是否在B和C 就是把B和C当作一个数据集合啦如果只有B 我会写 就是 select name from A where name is not in (select name from B)如果变成2张表呢怎么写SQL
解决方案 »
- 求助:将 varchar 转换为数据类型 numeric 时出现算术溢出错误。
- 问1个困扰人类很多年的SQL问题,请群众围观。。。
- select * from sysobjects where name=''与 select name='' from sysobjects
- 请教各位高手一个SQL语句或者一个存储过程的写法
- SQL2000远程连接问题
- exec(@sql)中的变量问题
- 求SQL查询最好的解决方法?(在线)
- 如何学好sql server呀?
- 高分急求,开发一个数字博物馆意见,方法:)
- 在Visual Foxpro中与COM进行通讯
- SQL 技能题
- 数据库一列字段拆分搜索的问题......
where not exists(select 1from B where Name =a.Name) and not exists(select 1 from C where Name=a.Name )不存豐B/C表的記錄
*
from
A
where
not exists(select 1 from B where Name =a.Name)
and
not exists(select 1 from C where Name=a.Name)
where name is not in (select name from B)
and name is not in (select name from C)
--or
select name from A
where not exists(select 1 from B where name=A.name)
and not exists(select 1 from C where name=A.name)