Answer the question
In order to leave comments, you need to log in
How to get rid of distinct?
There is a table A, to this table by the primary key there are other tables, each of which can contain many identical primary keys of tables A. There are additional selection conditions when querying table A. If you look at the code, it looks like this:
$query = TableA:find()
->joinWith(['tableb', 'tablec', 'tablee'], true, 'LEFT JOIN')
...
Answer the question
In order to leave comments, you need to log in
To remove duplicate TableA, you need to use distinct, which starts to slow down the query a lot when
Apparently you have the wrong join. If you post the code of the resulting request here, it will be easier to tell. By itself, the use of distinct indicates an incorrect approach to constructing a query. Alternatively, you can use join with a subquery, if necessary using group by
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question