计算时间戳小于 24 小时的行数
对于下面的查询,我如何计算 datesent
小于 24 小时的行数?(字段 datesent
是一个时间戳).
For the query below, how could I count the number of rows where datesent
is less than 24 hours old? (The field datesent
is a timestamp).
提前致谢,
约翰
$message = "SELECT datesent, recipient
FROM privatemessage
WHERE recipient = '$u'";
$messager = mysql_query($message);
$messagearray = array();
推荐答案
使用:
SELECT COUNT(*) AS cnt
FROM PRIVATEMESSAGE pm
WHERE pm.datesent >= DATE_SUB(NOW(), INTERVAL 1 DAY)
相关文章