i have the following and the COUNT(recnum) AS TotalCount counts all the records with a certain siteid and it works fine but i now need to know out of that total how many are completed so i tried COUNT(completeddate != '0000-00-00') AS TotalCompleted and thats not working. it just gives me the same as the first aggregate function. i tried to include some if statements but that didnt work either. any ideas?
Code:$query="SELECT siteid, completeddate, recnum, COUNT(recnum) AS TotalCount, COUNT(completeddate != '0000-00-00') AS TotalCompleted From WorkOrders GROUP BY siteid ORDER BY CAST(siteid AS UNSIGNED)";




Reply With Quote