I have an application that searches and shows user recommendations of different Institutions.
Each Institution can have any number of recommendations.
The results are presented per institute like so:
- Inst A has 6 recommendations
- inst B has 4 recommendations
- and so on...
I want to draw only ten Institutions at a time.
The problem is that my query refers to recommendations, and not to institutions, and therefore I end up getting 10 recommendations instead of 10 institutions.
Is there a way to tell MySQL that the limit refers to DISTINCT institutions, while still pulling in effect DUPLICATE institutions (i.e a number of recommendations on the same institute)?
The simpified versions of the actual query:
SELECT * FROM institutions
LEFT JOIN recommendations
ON institutions.InstitutionID = recommendations.InstitutionID
WHERE [SOMETHING]
LIMIT 10
a different way to present the question: Is it possible to make the LIMIT clause refer to the original SELECT without the JOIN?