php – DATEADD在我的查询中不起作用

我有一个问题,我无法弄清楚解决方案.使用之前提出的问题(SELECT rows with time 30 minutes or less?)我试图使我的COUNT(*)函数工作,但我无法使它工作.有人有想法吗?

$adViewUnique = $dbh->query('SELECT COUNT(*) FROM g_ad_view WHERE ad_view_time >= DATEADD(mi, -30, GETDATE())')->fetchColumn();


Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[42000]: Syntax error or access violation: 1305 FUNCTION 18RVS15.DATEADD does not exist' in /var/www/vhosts/ Stack trace: #0 /var/www/vhosts/ PDO->query('SELECT COUNT(*)...') #1 {main} thrown in /var/www/vhosts/ on line 38

WHERE ad_view_time >= now() - interval 30 minute

转载注明原文:php – DATEADD在我的查询中不起作用 - 代码日志