select 10 rows per day with order

前端 未结 9 823
感情败类
感情败类 2021-02-06 16:08

i have a db with records with date (timestamp) i need to select 10 records for each day (there are many more per day) and order them by few columns...

how should that qu

9条回答
  •  南旧
    南旧 (楼主)
    2021-02-06 16:37

    Here is a possible solution, but it will require a little work outside of sql. This is from a live example of a list of movies. All you need to do after this is pull the first 10 movies of the concatenated list.

    SELECT Movie_Release_Year, GROUP_CONCAT( Movie_Title
    ORDER BY Movie_Title ) 
    FROM movies
    GROUP BY Movie_Release_Year
    

    see Group Concat for more details

提交回复
热议问题