SELECT count(*) FROM T_BUY_ECASH AS A JOIN T_LECTURE AS B ON A.lecnum=B.num WHERE A.num= AND A.enddate > A.rdate AND date_format(A.enddate,'%Y%m%d') > '20080908' AND ((substr(B.code,1,3)!='018' ) OR (substr(B.code,1,3)='018' AND B.problem IS NULL))::1064You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'AND A.enddate > A.rdate AND date_format(A.enddate,'%Y%m%d') > '20080908' AND ((s' at line 1::: SQL Execute Fail...