helloise 0 Posted September 16, 2011 Share Posted September 16, 2011 i have this code: static public function getLastNewMessage($profile_id) { $c = new Criteria(); $subSelect = "rc_message_box_table.profile_id_from NOT IN ( SELECT rc_blocklist_table.profile_id_block FROM rc_blocklist_table WHERE profile_id = $profile_id ) and rc_message_box_table.profile_id_to=$profile_id and opened_once = 0"; $c->add(self::PROFILE_ID_TO, $subSelect, Criteria::CUSTOM); $c->addAsColumn("lastRow", MAX(self::ID)); //$subSelect2 = "max(rc_message_box_table.id)"; //$c->add(self::ID, $subSelect2, Criteria::CUSTOM); return self::doSelect($c); } and get this error: 500 | Internal Server Error | PropelException [wrapped: SQLSTATE[42000]: 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 'AS lastRow FROM rc_message_box_table` WHERE rc_message_box_table.profile_id_fro' at line 1] i just want the record of MAX(auto-increment-field) on the rc_message_box_table and this field is ID i have tried the commented out lines as well but nothing works. i dont know how to achieve this..please help? thank you Link to post Share on other sites
Recommended Posts
Archived
This topic is now archived and is closed to further replies.