日期:2014-05-18 浏览次数:20617 次
with cte as
(
select *, row_number() over( order by getdate()) as id from
(
select 住宿名单1 as col from tb
union all
select 住宿名单2 from tb
union all
select 住宿名单3 from tb
union all
select 住宿名单4 from tb
) as t
)
select * from cte as a where exists (
select * from cte as b
where a.col = b.col and
a.id <> b.id
)