http://expert.csdn.net/Expert/FAQ/FAQ_Index.asp?id=6420
就是你所要的

解决方案 »

  1.   

    试试:SELECT prod_type_id, product_id, product_name, max(pubdate) FROM product GROUP BY prod_type_id ORDER BY pubdate DESC;
      

  2.   

    sorry,又出昏招了,我的语句是错的!
      

  3.   

    :)
    需要将 product_name 与 pubdate 联合一起处理的
      

  4.   

    嘻嘻,我也练习一下:SELECT prod_type_id, 
      SUBSTRING(MAX(CONCAT(pubdate, product_id)), 9) as product_id, 
      SUBSTRING(MAX(CONCAT(pubdate, product_name)), 9) as product_name, 
      MAX(pubdate) 
      FROM product GROUP BY prod_type_id;
    因为pubdate表示的日期,长度应该都是8,所以没有用到犬犬介绍的帖子中LPAD()函数
      

  5.   

    我用临时表解决了,
    对于上面的方法,我正在学习ing
      

  6.   

    MYSQL的索引能选择是按ASC DESC排列吗?如果能定义、而且我的查询只需要其中一种排列的话那就可以不用那么麻烦写上面那种语句了。  嘿嘿,简单点。不过上面那个的确是好办法,呵呵。