I have 3 tables (MySQL):
- Students
- Groups
- StudentsToGroups
All tables presented like models and have their own classes.
So, I want to show in view list of students with their group's names. Very simple example in Volt
:
{% for student in students %}
{{ student.name }}
{% for student.getGroups() as group %}
{{ group.name }}
{% endfor %}
{% endfor %}
I guess that every time in nested loop will be JOIN
and when students count is huge there will be performance issue.
How can I do this in more right way?