[prev in list] [next in list] [prev in thread] [next in thread]
List: mysql
Subject: DATE problem
From: René_Fournier <m5 () renefournier ! com>
Date: 2005-02-01 20:38:12
Message-ID: 4b764cc988a037ea46967e1e4e229dad () renefournier ! com
[Download RAW message or body]
I'm trying to count rows that were added today. The column that I am
counting on is in DATETIME format, so there are hours and minutes and
seconds recorded, but I only need to check the date....
$sql = "SELECT
COUNT(table.id)
FROM table
WHERE table.created = NOW()";
$num = mysql_result(mysql_query($sql),0);
The problem with this is that unless the record was added at precisely
the same time as NOW()—which never happens—no rows are returned. Is
there a way I can round off table.created to just a DATE, then compare
it to CURDATE()?? I've been reading DATE Format functions, but am not
sure how to proceed.
Thanks in advance.
...René
---
René Fournier
www.renefournier.com
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql?unsub=mysql@progressive-comp.com
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic