日期:2014-05-19  浏览次数:20776 次

求sql語句

字段:           aa                 bb
                    001               张三
                    002               李四
                    001               王五
          求sql语句把aa字段中记录相同的显示出来?   即上述表中显示bb字段为张三及王五的记录出来.       谢谢


------解决方案--------------------

Select * From 表
Where aa In (Select aa From 表 Group By aa Having Count(aa) > 1)
------解决方案--------------------
SELECT * FROM AA IN (select aa from tb group by aa having count(*) > 1)
------解决方案--------------------
Select * From 表
Where aa In (Select aa From 表 Group By aa Having Count(aa) > 1)

------解决方案--------------------
SELECT * FROM tb where AA IN (select aa from tb group by aa having count(*) > 1)