PHP/MYSQL Percentage of total with rollup
Posted: Fri Feb 10, 2012 10:14 am
Hi everyone,
I'm trying to get the percentage of each person who performed work, but the total percentage is never 100%. It shows up as 99%. I've been struggling with this for quite some time. Does anyone have any helpful hints which may help resolve my issue?
I'm trying to get the percentage of each person who performed work, but the total percentage is never 100%. It shows up as 99%. I've been struggling with this for quite some time. Does anyone have any helpful hints which may help resolve my issue?
Code: Select all
<?PHP
$string = "SELECT COUNT(Therapist) AS Count, Round(100*COUNT(Therapist)/Count2,0) + '%' AS Percentage, Date_Of_Entry, Therapist, SUM(BILL_TIME) AS BILL_TOTAL
FROM tblprivatepracticedetails,
(SELECT COUNT( Therapist ) AS Count2
FROM tblprivatepracticedetails
) AS c
WHERE Date_Of_Entry Between '$FromDate' And '$ToDate' GROUP BY Therapist WITH ROLLUP";
$query = mysql_query($string) or die (mysql_error());
?>