I have a File table ,and a Admin table.
and the relation of Admin model is :
public function relations()
{
// NOTE: you may need to adjust the relation name and the related
// class name for the relations automatically generated below.
return array(
'Admin' => array(self::BELONGS_TO, 'ADMIN', 'ADMIN_ID')
);
}
it means every file is created by a admin.
in my admin table I have a name column beside username and password.
and i want to search file by the administrator’s name.
so I follow the step on Searching and sorting by related model in CGridView
it is a great toturial.
but it fail with CDbCommand can not excute SQL statement: SQLSTATE[HY000]: General error: 904 OCIStmtExecute: ORA-00904: "ADMIN"."NAME": Identifier is invalid
(ext\pdo_oci\oci_statement.c:148). The SQL statement executed was: SELECT COUNT(DISTINCT "t"."FILE_ID") FROM "HOUSE_FILE" "t" LEFT OUTER JOIN "HOUSE_ADMIN" "Admin" ON ("t"."ADMIN_ID"="Admin"."ADMIN_ID") WHERE (Admin.NAME LIKE :ycp0)
I think it is caused by the oracle database,
oracle take all table name and table alas name without Double quotes as upper case.
so it take Admin.NAME as ADMIN.NAME , but the Alias is "HOUSE_ADMIN" "Admin" "Admin",
consequently, it said "ADMIN"."NAME": Identifier is invalid.
I know the cause, and I know this issue can be fixed by add double quotes to Admin in Admin.NAME , unfortunately I do not how to add.
If somebody can help me ,I am so gratitude.