yii achieve even-table query in the model

The current model parameters and the corresponding data table can be a table with related through innseJoin, (Note that the table name to use partial)

 

first step:

INNER JOIN ( 'name to be associated with the table', 'two tables corresponding relevant fields')

 

Step two:

You can () specify the relevant conditions by andFilterWhere

$query->innerJoin('dtk_users', "dtk_inimate_manage.uid = dtk_users.id")
->andFilterWhere(['like', 'dtk_users.user_emall', '需要比较的词']);

Guess you like

Origin www.cnblogs.com/GetcharZp/p/12430354.html