R
R
rxxxel2021-11-10 14:25:27
Doctrine ORM
rxxxel, 2021-11-10 14:25:27

How to write a query to select a unique date in Doctrine?

Good afternoon, there is a table:

id int - statistics ID
client_id int - user ID
type int - view, click or download
from_type int - article or file
from_id int - article or file ID date
datetime - Date

for the whole day, the rest is skipped).

Answer the question

In order to leave comments, you need to log in

2 answer(s)
R
rxxxel, 2021-11-11
@rxxxel

Solution (not mine): distinct date(date_field)

S
sl0, 2021-11-10
@sl0

Well, for example, through qb

->andWhere('DATE(stat.datetime ) >= :start and DATE(stat.datetime ) <= :finish')
->setParameter('start', $start->format('Y-m-d'))
->setParameter('finish', $finish->format('Y-m-d'))
...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question