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:
Output: Let maximum m be 5