select a.* from tablename a,(select softType,max(AddTime) as AddTime from tablename group by softType) as b
where a.softType=b.softType and a.AddTime=b.AddTime

解决方案 »

  1.   

    select addtime,softType from table1 a where addtime = (select max(addtime) from table1 group by softType where softType=a.softType) group by softType
      

  2.   

    那有那么复杂:
    select softType,max(AddTime) as AddTime from software group by softType
      

  3.   

    OpenVMS(半知半解)、Yang_(扬帆破浪)    access 不能用呀
      

  4.   

    select * from table a where 
    (select count(sortype) from addTime>=a.addTime and sortType=a.sortType)=1
      

  5.   

    好象是有点错,不过大体思路就是这样,
    如果存在重复的sortype,用count(distinct sorttype)试试
    仅限于SQL,ACCESS就不不敢保证了!
      

  6.   

    我在SQL SERVER2000 下做过测试成功1、建立一个测试表数据如下:表名:softwareaddTime      softType
    2002-05-01 a
    2002-05-02 b
    2002-05-03 b
    2002-05-01 c
    2002-05-02 c
    2002-05-01 d
    2002-05-02 d
    2002-05-01 e
    2002-05-02 e
    2002-05-01 f
    2002-05-02 f
    2002-05-02 a

    按你的要求写的SQL 语句如下:
    SELECT MAX(addTime) AS 最新日期, softType AS 版本
    FROM software
    GROUP BY softType执行后返回数据如下:
    最新日期         版本
    2002-05-02 a
    2002-05-03 b
    2002-05-02 c
    2002-05-02 d
    2002-05-02 e
    2002-05-02 f