以前这个问题我看到过,可是刚才搜索没搜索到!请大家帮忙!我是用‘pname’和‘xh’两个字段来确定一条记录的,那么请问我想返回无重复记录的所有记录集!应该怎么写SQL语句?谢谢指教!!!!!!!!

解决方案 »

  1.   

    select distinct xh ,pname from table
      

  2.   

    表:T
    Select * From T a where Exists(Select Count(*) From T b where a.pName=b.pName and a.Xh=b.Xh Group by b.pName,b.Xh Having Count(*)=1)
      

  3.   

    select t1.* from t1,(SELECT a,b,count(1) as c
    FROM  t1  group by a,b having count(1)=1) as t2 where t1.a=t2.a and t1.b=t2.b
      

  4.   

    同意,用select ~~~
            from~~~~
            group by~~~
            having~~~~
      

  5.   

    select distinct xh ,pname from table
      

  6.   

    select distinct   字段名 from 表名
      

  7.   

    select xh ,pname from table group by xh ,pname
      

  8.   

    select distinct   字段名 from 表名 group by
      

  9.   

    已经高定了.快给分吧:select distinct .....后面的照旧