关系:
'users' => array(self::MANY_MANY, 'Users', 'comments_views(comment_id, user_id)', 'together' => true),
SQL:
LEFT OUTER JOIN "comments_views" "users_users"
ON (
"t"."id"="users_users"."comment_id"
)
LEFT OUTER JOIN "users" "users"
ON (
"users"."id"="users_users"."user_id"
)
如何修改关系以获取此 sql:
LEFT OUTER JOIN "comments_views" "users_users"
ON (
"t"."id"="users_users"."comment_id"
AND "users_users"."user_id" = <param>
)
LEFT OUTER JOIN "users" "users"
ON (
"users"."id"="users_users"."user_id"
)