How to write the query in yii,using findAll()

后端 未结 3 1448
名媛妹妹
名媛妹妹 2021-01-28 23:27

I have the following sql query, how can I write the query in yii using findAll()?

I am not using CDbCriteria and for the time being avoiding i

3条回答
  •  悲哀的现实
    2021-01-28 23:57

    Can you try this way:

    $c = array('join' => 
        array(
            'user' => array(
                'joinType' => 'INNER JOIN',
                'on' => 'user.id = t.user_id'
            ),
            'category' => array(
                'joinType' => 'INNER JOIN',
                'on' => 'category.id = t.category_id'
            ),
        ),
        'condition' => "t.category_id =1 and t.experience =2 and t.key_skills LIKE '%php%'"
    );
    $results = SearchEmployee::model()->findAll($c);
    

提交回复
热议问题