我想使用本机查询和 DATE_ADD 从表中选择数据,但总是出错,
这是我的 sql 请求:
$qb = $this->_em->createNativeQuery("select Coalesce (sum(p.nb_sms*p.nb_destination),0) as multiplesms , sum(p.nb_fax) as nbFax, sum(p.nb_Mail) as nbMail FROM push p WHERE p.id_user=$id and DATE_ADD(p.date_send,7,'DAY') > CURRENT_DATE() and p.statut>0 order by p.date_send Desc", $rsm);
我有一个错误
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 '7,'DAY') > CURRENT_DATE() and p.statut>0 order by p.date_send Desc' at line 1
请有任何想法