select cat_id,good_id,good_name from goods where good_id in(selct max(good_id) from goods group by cat_id);
把子查询语句查询出的某个字段作为条件
select * from (select cat_id,good_id,good_name from goods order by cat_id asc, good_id desc) as tep group by cat_id;
子查询查询出一个新的表,然后再给这个新表重新命名。
https://blog.csdn.net/qq_39380737/article/details/81127497https://blog.csdn.net/qq_39380737/article/details/81127497