Home > Q&A > body text
Use the from method to find the latest products under each column. Why are the results incorrect?
select goods_id,cat_id,goods_name from (select * from goods where 1 order by cat_id asc,goods_id desc )as tep group by cat_id;
雪漫雨悠2022-08-09 15:47:37
Grouping-》Sort-》Get the latest
Hello, I would like to ask why what I wrote is the same as what the teacher said, but the from clause in the middle does not work. The latest goods_id obtained is still the first value of each column before sorting.