Can order and limit be applied to a join?

Can order and limit be applied to a join?

TomBajzekTomBajzek Posts: 164Questions: 37Answers: 1

I have an application that needs only one record from a related table for each result in the main table. Is it possible to apply order and limit clauses to a leftJoin? If not, is there some other way to handle that?

Thanks,
Tom

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,512Questions: 1Answers: 10,472 Site admin
    Answer ✓

    So to clarify - does your data actually have a one-to-many structure, but you just want to pick the first from the "many"? That isn't something that the left join will do I'm afraid. You'd need to use an Mjoin and a suitable renderer to display just the first item.

    Allan

  • TomBajzekTomBajzek Posts: 164Questions: 37Answers: 1

    Allan,

    Yes, this relationship is one-to-many. (I'm just trying to display the most recent of a potential list of things.) I hadn't realized that Mjoin with a renderer would be the way to attack this. I'll give that a shot.

    Thanks for the suggestion,
    Tom

This discussion has been closed.