select type,max(name) from buy group by type

解决方案 »

  1.   

    SELECT select distinct type from buy 
      

  2.   

    我是对  newly_ignorant(不学无术)  说的
      

  3.   

    呵,呵.........你也在这儿问啊?sorry,我还是帮不了你楼上的,这不是只取了最大的name值吗?
      

  4.   

    select distinct type from buy 
    UNION
    select distinct NAME from buy 
      

  5.   

    楼上的方法好,用union将两个结果合成单个结果学习....看看符不符合贴主的查询要求了
      

  6.   

    microlong(微龙)
    出来的结果不是我想要的,还有其他的吗?谢谢!
      

  7.   

    select distinct(a.xsid),(select top 1 fs from table9 b where a.xsid = b.xsid)
      from table9 a
      

  8.   

    方法和GROUP很相似,但如果有重复的XSID用这个查询显示的是两比记录,所以好象还是不对,献丑:)
      

  9.   

    select distinct(a.xsid),(select max(fs) from table9 b where a.xsid = b.xsid)
      from table9 a