楚小白(提问者) 回复 小歆嵩SELECT date,code,name,quantity,coi,cshort,soi,sshort,sdeplete
FROM rq_coal_procurement_daily
WHERE YEAR(date) = YEAR(\'${date1}\')
and MONTH(date) = MONTH(\'${date1}\')
AND day(date) between 1 and day(\'${date1}\')
AND(MONTH(\'${date1}\')=1 or MONTH(\'${date1}\')=7)
union all
SELECT date,code,name,quantity,coi,cshort,soi,sshort,sdeplete
FROM rq_coal_procurement_daily
WHERE year(date1) = YEAR(\'${date1}\')
and MONTH(\'${date1}\') not in (1,7)
and date between last_day(DATE_SUB(\'${date1}\',INTERVAL 1 MONTH)
and \'${date1}\'
我把你写的内容替换了,最后是这么写的,然后报错:check the manual that corresponds to your mysql server version for the right syntax to user near \'\' at line 13