我的个人博客:逐步前行STEP

示例:
1、将文章按类型的分组,并获取类型分组中最新的一篇文章

select author,max(`updated_at`) as updated_at from articles 
    group by category_id
    order by updated_at desc

2、将文章按类型的分组,并获取类型分组中阅读量最小的一篇文章

select author,min(`read_cnt`) as read_cnt from articles 
    group by category_id
    order by read_cnt

标签: none

添加新评论