I have this query:
$currentIssue = Issue::model()->find(array( 'condition'=>'number = (SELECT max(number) FROM issue))' ));
Which looks good to me and works in phpMyAdmin.
But Yii gives me this error:
SQLSTATE: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') LIMIT 1' at line 1. The SQL statement executed was: SELECT * FROM `issue` `t` WHERE number = (SELECT max(number) FROM issue)) LIMIT 1
Somehow it is adding an additional brace at the end of the subquery.
When I remove the last brace from the condition (which looks wrong to me) the query is working. Can anyone explain to me why this is?