select id, title, max(time), answername
from table1
group by id
having time = max(time)

解决方案 »

  1.   

    select 回复人,回复时间 from tablename where id = '???' and 回复时间 = (select max(回复时间) from tablename where id = '???')
      

  2.   

    tj_dns(愉快的登山者)兄,我希望的并不是只选择一条记录!
    而且对表里所有的记录都选择
    然后一条条的把主题列出来,主题后面跟着最后回复人或者回复时间回iamxia兄,按你的方法它报错!
    我搞不明白的是,having time这个time是自己定义的,还是表里的那个time
      

  3.   

    select *
    from tablename a
    where time=(select max(time) from tablename where id=a.id)
    and ...
      

  4.   

    经理!你没搞明白偶的意思~
    就比如实现csdn里的这样吧
    --------------------------------------------------------
     问 题                                  分数 回复  时间    功能 
     
     怎样用ado访问一个.dbf表? (binling )  20 7 11-08 12: 05 管理  
     紧急求助:如何将字符串中的数字和字母转化为全角字符? (mingyeh )  100 2 11-08 12: 04 管理    
    ------------------------------------------------
    假设存在表board,包含:
    id,title,addname,point,re,time,manage
    分别一一对应以上!"怎样用ado访问一个.dbf表?"这条记录里的time肯定是它发贴时候的时候,但显示的时候需要让它显示成最后回复的时间"11-08 12: 05 "怎么实现?
      

  5.   

    select id,title,addname,plint,re,b.time
    from board a,
    (select id,time_max=max(time)
     from 回复记录明细表
     group by id) as b
    where a.id = b.id
      

  6.   

    select a.id,title,addname,plint,re,b.time_max
    from board a,
    (select id,time_max=max(time)
     from 回复记录明细表
     group by id) as b
    where a.id = b.id