news_title,news_content,htm_name这几字段的值会相同吗?如果不会你可以这样:
select news_title,news_class,news_content,max(addtime),htm_name from news_content group by news_class,news_title,news_content,htm_name  
如果会出现重复的你就需要做两次查询
select news_class,max(addtime) from news_content group by news_class
把news_class,addtime值取出来作为下面查询的条件,这种方式你要保证时间的唯一性。
select news_title,news_class,news_content,addtime,htm_name from news_content where news_class = and addtime

解决方案 »

  1.   

    webmin(webmin)=>你可能没有弄清我的意思:是这样的,我表中的news_class是一个新闻类别的字段(比如国内新闻、国际新闻、体育新闻.........)等好多种,我现在有一个页面想要读出每个类别的最新一条新闻,其中addtime字段是新闻加入到表里的时间。
      

  2.   

    select news_title,news_class,news_content,addtime,htm_name from news_content group by news_class order by addtime desc
    把后面的去掉,看看
      

  3.   

    select a.news_title,a.news_class,a.news_content,a.addtime,a.htm_name,min(b.addtime) from news_content as a,news_content as b group by b.news_class,a.addtime having a.addtime=min(b.addtime) order by a.addtime desc limit 14