I need to make an SQL query in MySQL, the query should select from two tables store and item, store has one or more items, the query should select from these two tables ordered by created date from store table and updated date from item table, with maximum number of items is 10 of each store, means no more than 10 items of each store if the store has more than 10 items, I think about doing this query:
select *
from store s, item i
where s.store_id = i.store_id
and i.item_id in (select i1.item_id
from item i1
where i1.store_id = s.store_id
limit 10)
group by s.store_id, i.item_id
order by s.created_at, i.updated_at
but I got an error
This version of MySQL doesn't yet support limit in subquery
Is there any way around to do that?