I don't know if this is possible in mysql via an ONE query.
Assuming I have a "products" table that has "id", "category_id", "product_name", "price"
Case 1: I want to get 5 products from each category, where the price is more than $ 100
Case 2: I want to get
1- "3 products from category 1"
2- "5 products from category 2"
3- "3 products from category 2, where the price is more than 100 and not selected in paragraph 2 above"
each case in one question, is this possible?
PS: the table has about 100 thousand rows ...
source share