S
S
sazareks2018-05-12 22:18:19
MySQL
sazareks, 2018-05-12 22:18:19

Sampling from the mysql database having two dates and fields for conducting classes?

There is a table with classes, with a number, title and days on which day the lesson takes place, here is an example of data:
id 1
title Title of the lesson
on_monday 1
on_tuesday 0
on_wednesday 1
on_thursday 0
on_friday 1
on_saturday 0
on_sunday 0
You need to have a date for example from 05/07/18 to 05/10/18 find all the classes that will take place. How can this be implemented?
Perhaps there is a better architecture option?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Arman, 2018-05-12
@Arik

Without PHP, it will probably be difficult, as option
1. look if there are more than 7 days, then all days of the week are involved, if less then we find which weeks there are
2. in the database, you can try the SET type or a bit mask so as not to store so many columns and not do a bunch of conditions

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question