CREATE ALGORITHM = UNDEFINED DEFINER = `aerion`@`localhost` SQL SECURITY DEFINER VIEW `aerion`.`vw_rpt_hours_calc` AS SELECT `aerion`.`rpt_hours_calc`.`rpt_hour_id` AS `rpt_hour_id`, `aerion`.`rpt_hours_calc`.`hour_id` AS `hour_id`, `aerion`.`rpt_hours_calc`.`emp_id` AS `emp_id`, `aerion`.`emp`.`firstname` AS `firstname`, `aerion`.`emp`.`lastname` AS `lastname`, `aerion`.`rpt_hours_calc`.`comp_id` AS `comp_id`, `aerion`.`company`.`companyname` AS `companyname`, `aerion`.`rpt_hours_calc`.`bill_cycle_start_dt` AS `bill_cycle_start_dt`, `aerion`.`rpt_hours_calc`.`bill_cycle_end_dt` AS `bill_cycle_end_dt`, SUM(`aerion`.`rpt_hours_calc`.`expected_hrs`) AS `expected_hrs`, SUM(`aerion`.`rpt_hours_calc`.`billable`) AS `billable`, SUM(`aerion`.`rpt_hours_calc`.`non_billable`) AS `non_billable`, SUM(`aerion`.`rpt_hours_calc`.`total_hrs`) AS `total_hrs`, SUM(`aerion`.`rpt_hours_calc`.`hrs_diff`) AS `hrs_diff`, SUM(`aerion`.`rpt_hours_calc`.`inv_diff`) AS `inv_diff`, `aerion`.`rpt_hours_calc`.`cycle_type` AS `cycle_type`, `aerion`.`rpt_hours_calc`.`bill_due_dt` AS `bill_due_dt`, `aerion`.`rpt_hours_calc`.`hrs_date` AS `hrs_date` FROM ((`aerion`.`rpt_hours_calc` LEFT JOIN `aerion`.`emp` ON ((`aerion`.`rpt_hours_calc`.`emp_id` = `aerion`.`emp`.`emp_id`))) LEFT JOIN `aerion`.`company` ON ((`aerion`.`rpt_hours_calc`.`comp_id` = `aerion`.`company`.`comp_id`))) GROUP BY `aerion`.`rpt_hours_calc`.`bill_cycle_start_dt` , `aerion`.`rpt_hours_calc`.`bill_cycle_end_dt` , `aerion`.`rpt_hours_calc`.`cycle_type`