SQL查询语句,达人请指教

来源:百度知道 编辑:UC知道 时间:2024/06/30 14:30:06
我要将一个表中的一列值和另一张表中的一列值对比后查询出第一张表中和第二列中没有重复的所有值,以下是查询重复值的句子,请达人帮助写出查询不重复值的句子,谢谢~
select one.*
from one,two
where phone=phone2

SELECT [1].company, [1].phone, [1].name1
FROM 1 LEFT JOIN 2 ON [1].phone = [2].phone
WHERE ((([2].phone) Is Null));

select distinct * from one,two where phone=phone2

create table #table1
(
UID int identity primary key,
col1 varchar(50)
)
go
create table #table2
(
UID int identity primary key,
col1 varchar(50)
)
go
delete #table1
delete #table2
go
insert #table1(col1) values('aaa')
insert #table1(col1) values('bbb')
insert #table1(col1) values('ccc')
insert #table1(col1) values('ddd')

insert #table2(col1) values('ccc')
insert #table2(col1) values('ddd')
insert #table2(col1) values('eee')
insert #table2(col1) values('fff')
go
select * from #table1
select * from #table2
go
------------------------------
select * from #table1 where UID not in (
selec