读书人

超难得有关问题

发布时间: 2012-01-21 21:31:43 作者: rapoo

超难得问题
在查询的时候怎么将只有一条记录的数据过滤掉,只查找出有1条以上的记录

[解决办法]
create table #(id int identity,id1 varchar(2))
insert into # select 1
union all select 1
union all select 2
union all select 3
union all select 3
select a.id,a.id1 from # a ,# b where a.id1=b.id1 and a.id <> b.id

读书人网 >SQL Server

热点推荐