N
N
Nord Dev2020-06-14 16:26:11
symfony
Nord Dev, 2020-06-14 16:26:11

How to take users who logged in on other days?

Help build a query builder or solve it in some other way.
There are unique users, you need to take only those who came not only on one day, but also on other days. In a table with an entry date called date. More or less fast request is necessary, therefore it is desirable to find room in one in this request somehow.
Now the query is this, it gives out unique users:

$query = $this->createQueryBuilder('a')
            ->leftJoin('a.event', 'e')
            ->leftJoin('a.customer', 'c')
            ->select('count(distinct c.id) as counter')
            ->where('e.id = :id')
            ->andWhere('a.page = :page')
            ->andWhere('c.status = :customer')
            ->andWhere('distinct a.date = a.date')
            ->setParameter('id', $event)
            ->setParameter('page', $page)
            ->setParameter('customer', $customer)
            ->getQuery()
            ->getOneOrNullResult();

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question