DATE_SUB(CURDATE(),INTERVAL 3 MONTH) GROUP BY contacts.contact_id ORDER BY last_name, first_name) AS total_hours3 ON total_hours.contact_id = total_hours3.th3_contact_id LEFT JOIN (SELECT contacts.contact_id AS vh3_contact_id, COUNT(shop_hours.contact_id) as vh3_visits, ROUND(SUM(HOUR(SUBTIME( TIME(time_out), TIME(time_in))) + MINUTE(SUBTIME( TIME(time_out), TIME(time_in)))/60)) AS vh3_hours FROM shop_hours LEFT JOIN contacts ON shop_hours.contact_id = contacts.contact_id LEFT JOIN shop_user_roles ON shop_hours.shop_user_role = shop_user_roles.shop_user_role_id WHERE shop_user_roles.volunteer = 1 AND time_in > DATE_SUB(CURDATE(),INTERVAL 3 MONTH) GROUP BY contacts.contact_id ORDER BY last_name, first_name) AS volunteer_hours3 ON total_hours.contact_id = volunteer_hours3.vh3_contact_id"; $Recordset1 = mysql_query($query_Recordset1, $YBDB) or die(mysql_error()); //$row_Recordset1 = mysql_fetch_assoc($Recordset1); //Wait to fetch until do loop $totalRows_Recordset1 = mysql_num_rows($Recordset1); ?>
Hours by User
Shop User Last 3 Months Lifetime
Volunteer
Hours
Total
Hours
Visits Volunteer
Hours
Total
Hours
Visits