试试:SELECT prod_type_id, product_id, product_name, max(pubdate) FROM product GROUP BY prod_type_id ORDER BY pubdate DESC;
sorry,又出昏招了,我的语句是错的!
:) 需要将 product_name 与 pubdate 联合一起处理的
嘻嘻,我也练习一下: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()函数
需要将 product_name 与 pubdate 联合一起处理的
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()函数
对于上面的方法,我正在学习ing