I'm having problems counting rows in mySQL with a WHERE clause. For example:
-----------------------------------
$query = "SELECT COUNT(this_date), user";
$query .= "FROM here ";
$query .= "WHERE this_date < CURRENT_DATE AND user = '$UID' ";
$query .= "GROUP BY this_date";
-----------------------------------
This query counts this_date fine, except it isn't limiting it's count to the dates less than the current date. It's even limiting the count by the $UID I pass to it. Just not by the current date.
Umm, help! I'm not really clear on how COUNT and GROUP BY works with WHERE clauses.
Any help is greatly appreciated.
chadT
-----------------------------------
$query = "SELECT COUNT(this_date), user";
$query .= "FROM here ";
$query .= "WHERE this_date < CURRENT_DATE AND user = '$UID' ";
$query .= "GROUP BY this_date";
-----------------------------------
This query counts this_date fine, except it isn't limiting it's count to the dates less than the current date. It's even limiting the count by the $UID I pass to it. Just not by the current date.
Umm, help! I'm not really clear on how COUNT and GROUP BY works with WHERE clauses.
Any help is greatly appreciated.
chadT