Select top 10 records for each category

前端 未结 14 1441
别那么骄傲
别那么骄傲 2020-11-22 04:27

I want to return top 10 records from each section in one query. Can anyone help with how to do it? Section is one of the columns in the table.

Database is SQL Serve

14条回答
  •  傲寒
    傲寒 (楼主)
    2020-11-22 05:30

    Might the UNION operator work for you? Have one SELECT for each section, then UNION them together. Guess it would only work for a fixed number of sections though.

提交回复
热议问题