0

我正在尝试获取昨天的查询!使用此代码,我可以获得今天的查询,但我不知道应该怎么做才能显示昨天的查询:

$t_date = date( 'Y-m-d H:i', $_TIME - (3596 * 24) );
$twall = $db->super_query("SELECT COUNT(*) as c 
                             FROM dle_photo_post 
                            WHERE date > = '$t_date'
                              AND date < = '$t_date' + INTERVAL 24 HOUR 
                              AND moder = '0' ");

$twall = $twall['c'];  
4

1 回答 1

0

尝试这个:

SELECT COUNT(*) as c 
FROM dle_photo_post 
WHERE date between 
                date_sub(curdate(), interval 2 day) 
            and date_sub(curdate(), interval 1 day)
    AND moder = '0'
于 2012-10-07T02:10:47.063 回答