I have a table called TransResult and I have 2 data fields in it. I want to get the percentages for the 2 possiable values in TransResult and I want this done by date, so I can go backwards to compare what was done in the past months to what is done in current month.
This is what i have come up with so far, however my total is giving me ALL records in the table not this months records, so my percentages are off, aside from the total the values it is calculating are correct.
Can someone help me work through this.
SELECT TransResult, COUNT() AS HowMany, (COUNT() / total ) 100 AS Percent FROM tbltranslog, (SELECT COUNT() AS total FROM tbltranslog) AS myTotal WHERE MONTH(Date) = MONTH(NOW()) +0 GROUP BY transresult
thanks.