A
A
Alexander Sinitsyn2018-10-04 15:47:54
Yii
Alexander Sinitsyn, 2018-10-04 15:47:54

Two related tables. How to build a query to get from the first only the records to which there are links from the second?

At least somehow there are no working options, tk. none work)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry Bay, 2018-10-04
@a_u_sinitsin

something like this:

Model1::find()
->joinWith(['model2'])
->andWhere('model2.field is not null');

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question