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/[EMAIL PROTECTED]



Reply via email to