L
L
loguf12019-05-07 21:12:46
MySQL
loguf1, 2019-05-07 21:12:46

How to make a selection in a grouped format?

There is a timetable with the class schedule

5cd1c96484b77660616538.png

It is necessary to display the schedule of each group for the current day in this form

5cd1c9a09b097308003186.png

To get in this format from the database will not work, as far as I understand (an array with arrays of activities for each group).
Therefore, I have 2 options:
1. Iterate through all the groups, find the activities for each group for today
2. Iterate through all the activities for today, somehow make an array with groups out of this The
second option I think is more normal, but something tells me that there is better solution...

Answer the question

In order to leave comments, you need to log in

1 answer(s)
L
Lazy @BojackHorseman MySQL, 2019-05-07
@loguf1

second option, yes. select all classes for today, sorted by group and start time. transfer to the view, draw from the list there as required.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question