日期:2014-05-17  浏览次数:20884 次

求一查询不重复记录语句
本帖最后由 az702323466yhtzl 于 2013-03-09 14:30:40 编辑
AA      BB

2   100
100   101
100   101
101   102
101   102
1   101
1   101
101    102
101   102
101     102
101   102
105   106
105   106
105   106
105   106
105   104
105   104
105   104
105   104
105   104
105   104
105   104
104   105
104   105
104   105

求AA,BB内 不重复的数据 如上面的数据查出(1.2.100.101.105.104.102.106)
sql sqlserver .net

------解决方案--------------------
select distinct * from 表名
------解决方案--------------------
select distinct col from (select col1 as col from tb union all select col2 from tb)t