教条中的DATE_SUB和INTERVAL

时间:2012-03-29 08:23:40

标签: php mysql sql doctrine

SELECT * FROM mytable WHERE date < DATE_SUB(NOW(), INTERVAL 30 DAY);

我如何在Doctrine 1.2中做到这一点?

1 个答案:

答案 0 :(得分:4)

你试过这个答案吗? how to make Doctrine_Expression ( doctrine 1.2 ) try to get last 7 days

$date = new Doctrine_Expression('DATE_SUB(NOW() , INTERVAL 30 DAY)');
$q->where('date > ' . $date);