Answer the question
In order to leave comments, you need to log in
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
something like this:
Model1::find()
->joinWith(['model2'])
->andWhere('model2.field is not null');
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question