select count(*) as scheduled from notifications where date_format(dateScheduled, '%Y-%m-%d') = curdate();
select count(*) as delivered from notifications where date_format(dateScheduled, '%Y-%m-%d') = curdate() and dateSent is not null;

Thanks!

busboy
—
2014-02-07T19:39:20Z —
#2

Nevermind. I think this is working good for me:

select
(select count(*) from notifications where date_format(dateScheduled, '%Y-%m-%d') = curdate()) as scheduled,
(select count(*) from notifications where date_format(dateScheduled, '%Y-%m-%d') = curdate() and dateSent is not null) as delivered
FROM notifications group by scheduled, delivered;

r937
—
2014-02-07T20:36:16Z —
#3

busboy said:

where date_format(dateScheduled, '%Y-%m-%d') = curdate()

while that does work, it's not the most efficient approach

a simpler method is this --

WHERE DATE(dateScheduled) = CURRENT_DATE()

however, this too suffers from an efficiency problem

using a function on a table column pretty much rules out index optimization, and the database optimizer will often just do a table scan

here is a much better approach that will utilize an index on the column --