Answer the question
In order to leave comments, you need to log in
Which date selection is more correct?
There is a record, say User
, with a field CreatedAt = 1999-11-12 15:32:55
and many more users that were created that day.
There are two options for sampling:
1 - the first, sampling from this day 1999-11-12 00:00:00 to The 1999-11-13 00:00:00
request is something like this:
->select(*)
->from(User::class, 'alias')
->where('alias.createdAt >= :stratOfDay')
->setParameter(':startOfDay = 1999-11-12 00:00:00')
->where('alias.createdAt <= :endOfDay')
->setParameter(':endOfDay= 1999-11-13 00:00:00')
->from(User::class, 'alias')
->where('alias.createdAt >= :date')
->setParameter(':date= 1999-11-12')
Answer the question
In order to leave comments, you need to log in
The interval option is correct:
https://stackoverflow.com/questions/14104304/mysql...
The DATE() option is a time killer
And of course, using DATE() makes the index impossible, since you always need to go through it to calculate it over all values and calculate)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question