I have 2 tables, which are connected in a one to many relationship. The first table called papers has an id and the other named pictures having paperid as reference to the paperid.
What I'm trying to do is to select all pictures which are associated with each paper. That i can do by building a join, the problem is I can't figure out how to limit the selection of papers, but still want to fetch all the pictures for each paper within the limit.
limit = 4
papers 1: 3 pictures
papers 2: 16 pictures
papers 3: 10 pictures
papers 4: 2 pictures
Hope you understand can help, it should be fairly simple, but I just simply can't get the correct solution.