1
WHEN IAM TRYING TO GET invoice created user and grn created user i am getting this error...

CDbCommand 未能执行 SQL 语句:SQLSTATE [42000]:语法错误或访问冲突:1066 不是唯一的表/别名:“用户”。执行的 SQL 语句是: SELECT t。作为,id.`grn ......t0_c0t

 $criteria->with = array(
                "invoice.user" => array('select' => 'display_name'),
                "grn.user" => array(
                    'select' => 'display_name',
                ),


    );

请帮我解决这个问题...

4

1 回答 1

2

您应该为其中一个(或两个)关系指定别名,如下所示:

$criteria->with = array(
  "invoice.user" => array(
    'alias' => 'invoiceUser', 
    'select' => 'display_name'
  ),
  "grn.user" => array(
    'alias' => 'grnUser',
    'select' => 'display_name',
  ),
);
于 2013-08-28T02:06:55.193 回答