begin select IFNULL(M_PatientLocation, '-') as M_PatientLocation, case when left(T_OrderHeaderM_PatientAge,2) < '30' then "< 30 th" when left(T_OrderHeaderM_PatientAge,2) >= '30' and left(T_OrderHeaderM_PatientAge,2) < '40' then "30 -< 40 th" when left(T_OrderHeaderM_PatientAge,2) >= '40' and left(T_OrderHeaderM_PatientAge,2) < '50' then "40 - < 50 th" when left(T_OrderHeaderM_PatientAge,2) >= '50' then "> 50 th" else "" end as umur, count(Mcu_OrderT_OrderHeaderID) as total, concat('http://localhost/one-api/tools/mcu_chart/mcu003/',Mcu_OrderMgm_McuID) as Graph from one_etl.mcu_order join t_orderheader on Mcu_OrderT_OrderHeaderID = T_OrderHeaderID and T_OrderHeaderIsActive = 'Y' left join m_patient ON T_OrderHeaderM_PatientID = M_PatientID AND M_PatientIsActive = 'Y' where Mcu_OrderMgm_McuID = PID group by M_PatientLocation, case when left(T_OrderHeaderM_PatientAge,2) < '30' then "< 30 th" when left(T_OrderHeaderM_PatientAge,2) >= '30' and left(T_OrderHeaderM_PatientAge,2) < '40' then "30 -< 40 th" when left(T_OrderHeaderM_PatientAge,2) >= '40' and left(T_OrderHeaderM_PatientAge,2) < '50' then "40 - < 50 th" when left(T_OrderHeaderM_PatientAge,2) >= '50' then "> 50 th" else "" end; end