Answer the question
In order to leave comments, you need to log in
How to specify a condition for the required database table in a findAll query in yii1?
There is a query with connections, I need this condition 'client_id = :client_id', array(':client_id' => 1) Applied only for the Contacts model and its table. In the form that the query is now, it throws an error CDbCommand failed to execute the SQL query: SQLSTATE[23000]: Integrity constraint violation: 1052 Column 'client_id' in where clause is ambiguous
Due to the fact that the client_id field exists in several tables, and you need to specify in the condition for which table to apply it. Here is the request. How to do it right?
$model= Contacts::model()->with(
'staffCompanies',
'category',
'staffCompanies.contactsFavourites',
'staffCompanies.phoneStaffCompanies',
'staffCompanies.networkStaffCompanies',
'staffCompanies.emailStaffCompanies',
'staffCompanies.messengersStaffCompanies'
)->findAll('client_id = :client_id', array(':client_id' => 1));
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question