select Dname, Dnum  from Dtable where Dnum in (select distinct Dnum from Dtable)

解决方案 »

  1.   

    select max(Dname),Dnum from Dtable group by Dnum
      

  2.   

    好象不行哦!
    第一个 还是可能出现  这种情况的
    马拉            4809
    马拉湾          4809
    第二个只能得到Dname的统计数啊!
      

  3.   

    select * from Dtable where rowid in
    (select max(rowid) from Dtable group by Dnum)
      

  4.   

    第一中情况是我一时糊涂
    不过第二个应该可以啊
    是max,min而不是sum
    还有一种mssql的写法,就怕oracle里不实用
    select (select top 1 Dname from Dtable where Dnum=a.Dnum) Dname,Dnum from (select distinct Dnum from Dtable) a
      

  5.   

    呵呵,上面老兄的oracle 写法应该好使了