• 每个分类取5条, Sql解决方法


    一。select * from(
    select ID,ShopClient_ID,Name,Icon,HitCount,Class1_ID,row_number() over(partition by Class1_ID order by HitCount desc)
    as rowindex from tab_Goods)a
    where rowindex<=5

    二。SELECT  * FROM tab_Goods a
    WHERE (SELECT count(*) FROM tab_Goods b WHERE b.Class1_ID=a.Class1_ID AND b.ID>a.ID)<5
    ORDER BY Class1_ID desc

  • 相关阅读:
    maven
    sublime text
    ios category
    python
    activiti
    出版社
    gradle
    selenium
    spring
    Ansible状态管理
  • 原文地址:https://www.cnblogs.com/Vlaner/p/3809943.html
Copyright © 2020-2023  润新知