I have a table Item ( id, itemType)
. itemType
can be from 1-5.
I want to retrieve 2 items of each type using mysql.
I tried
select * from `item` ORDER BY `itemType` limit 2
which gives me 2 items order by type but I want 2 items of each type.
You can use below query, even i did not check it with data as I dont have sample data so if you get any issue then you can create a sqlfiddle, so that I can customize query as per you in #sql
Even you can ordering based on top price or any other field.