Reputation: 94
WHEN IAM TRYING TO GET invoice created user and grn created user i am getting this error...
CDbCommand failed to execute the SQL statement: SQLSTATE[42000]: Syntax error or access violation: 1066 Not unique table/alias: 'user'. The SQL statement executed was: SELECT
t
.id
ASt0_c0
,t
.`grn ......
$criteria->with = array(
"invoice.user" => array('select' => 'display_name'),
"grn.user" => array(
'select' => 'display_name',
),
);
please help me to solve this...
Upvotes: 1
Views: 4034
Reputation: 43
You should specify an alias for either (or both) of the relationships like this:
$criteria->with = array(
"invoice.user" => array(
'alias' => 'invoiceUser',
'select' => 'display_name'
),
"grn.user" => array(
'alias' => 'grnUser',
'select' => 'display_name',
),
);
Upvotes: 2