我在MySQL中有一個查詢工作正常,但是當我將查詢複製到我的PHP文件中時,它引發了一個語法錯誤:** unexpected「)爲week_ending
**什麼是我失蹤PHP腳本中的MySQL語法錯誤
的MySQL:
'SELECT COUNT(*) as
count
,region
, DATE_FORMAT(NOW(),'%d %b %y') asweek_ending
FROM stores.stats WHEREdate
> DATE_ADD(DATE(NOW()), INTERVAL -1 WEEK) ANDdate
< DATE(NOW()) GROUP BYregion
, DATE(NOW())';
PHP:
$stmt = DB::query(Database::SELECT, 'SELECT COUNT(*) as
count
,region
, DATE_FORMAT(NOW(),'%d %b %y'), asweek_ending
FROM stores.stats WHEREdate
> DATE_ADD(DATE(NOW()), INTERVAL -1 WEEK) ANDdate
< DATE(NOW()) GROUP BYregion
, DATE(NOW())';