1
SELECT * FROM mytable WHERE date < DATE_SUB(NOW(), INTERVAL 30 DAY);
我該如何在Doctrine 1.2中做到這一點?DATE_SUB和INTERVAL in Doctrine
SELECT * FROM mytable WHERE date < DATE_SUB(NOW(), INTERVAL 30 DAY);
我該如何在Doctrine 1.2中做到這一點?DATE_SUB和INTERVAL in Doctrine
您試過此答案嗎? 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);
是否需要在其他系統上運行那麼MySQL?如果不是的話,你只需在DQL中按上述方式編寫它。 – 2012-03-29 08:26:26