MySQL server error report:Array ( [0] => Array ( [message] => MySQL Query Error ) [1] => Array ( [sql] => SELECT count(*) FROM `cd_comment`as a ,(select g.brand_id, g.goods_name,h.brand_name,g.goods_id,g.goods_thumb from cd_goods as g,cd_brand as h where g.brand_id=h.brand_id ) b WHERE 1 and a.`id_value` = b.goods_id and a.parent_id=0 AND a.status = 1 and a.comment_type=0 order by (CASE WHEN a.id_value =980 THEN 0 else 1 END),(CASE WHEN b.brand_id = THEN 0 else 1 END) ,a.recommand,a.comment_id DESC ) [2] => Array ( [error] => 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 'THEN 0 else 1 END) ,a.recommand,a.comment_id DESC' at line 1 ) [3] => Array ( [errno] => 1064 ) )