读书人

一句SQL语句的有关问题

发布时间: 2012-01-15 22:57:48 作者: rapoo

一句SQL语句的问题
select * from A where a=1

select * from B where b=2

我想查出来a=1的数据同时排除掉b=2的数据

请问如何用一个select的语句来实现?

[解决办法]
where a=1只显示a=1的数据啊,不明白LZ的意思
[解决办法]
有关联的主键么
[解决办法]
SQL Server的差集是比较难做的

如果是SQL Server 2005 简单一点

select * from A where a=1
EXCEPT
select * from B where b=2


[解决办法]
select * from A where a=1 and not in select * from B where b=2

这样的??
[解决办法]
SQL Server的差集 没有任何关联的两个表 要差集做什么。。。。不明白
[解决办法]
表有什么?
[解决办法]
slect * from a where a=1 and b !=2
[解决办法]
select * from a where b not in(select * from where b=2) and a=1

读书人网 >asp.net

热点推荐