WHEN IAM TRYING TO GET invoice created user and grn created user i am getting this error...
CDbCommand无法执行SQL语句:SQLSTATE [42000]: 语法错误或访问冲突:1066不唯一的表/别名:'user'。 执行的SQL语句是:SELECT
t
。id
ASt0_c0
,t
。`grn ......
$criteria->with = array(
"invoice.user" => array('select' => 'display_name'),
"grn.user" => array(
'select' => 'display_name',
),
);
请帮我解决这个问题......
答案 0 :(得分:2)
您应该为这两种关系指定一个别名,如下所示:
$criteria->with = array(
"invoice.user" => array(
'alias' => 'invoiceUser',
'select' => 'display_name'
),
"grn.user" => array(
'alias' => 'grnUser',
'select' => 'display_name',
),
);