0

I have a table called data with columns id, category, name, timestamp.

I want to select rows from the table where category IN ('a', 'b', 'c'), with a condition that only a maximum m number of rows from category a, m rows from category b and m rows from category c are selected and ordered by id ascending.

Sample Data:

enter image description here

Output: Let maximum m be 5

enter image description here

Mr Cathode
  • 73
  • 14

0 Answers0