I have two tables Item an Owner, an a Foreign Key from Item to Owner, owner_id. I'm using PostgreSQL 10.
For each owner I want to get the first 3 items if exist.
select "items_item"."name"
FROM "items_item"
WHERE ("items_item"."owner_id" IN (64, 65, 130, 99, 43, 140, 108, 143, 115, 154))
ORDER BY LIMIT 3
Clearly is not ok, because is selecting just 3 items from all owners, not a maximum 3 items per owner .