Answer the question
In order to leave comments, you need to log in
How to build a complex Yii2 query using ActiveRecord?
How to build such a query in yii2 using ActiveRecord:
SELECT
professions.professionID,
professions.professionCode,
professions.professionNameRU
FROM profession_cafedra
INNER JOIN professions
ON profession_cafedra.professionID = professions.professionID
INNER JOIN cafedras
ON profession_cafedra.cafedraID = cafedras.cafedraID
WHERE cafedras.FacultyID = 1
Answer the question
In order to leave comments, you need to log in
Good morning.
The link describes everything in detail
https://github.com/yiisoft/yii2/blob/master/docs/g... (Using JOIN with links)
Для начала надо создать связи в модели professions:
www.yiiframework.com/doc-2.0/guide-db-active-recor...
потом составить запрос используя joinWith:
описано там же в разделе "Joining with Relations"
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question