-------------------------------------------------- djha-list -------------------------------------------------- SELECT d.id, d.djha_date AS date, d.created_at, e.first_name || ' '||e.middle_name || ' '||e.last_name AS submitted_by FROM daily_job_hazard_analysis d INNER JOIN users u ON ( u.id = d.user_id ) INNER JOIN employee e ON ( e.id = u.employee_id ) WHERE d.project_id = 3 AND Strftime('%Y-%m-%d', d.created_at) >= '2018-10-10' AND Strftime('%Y-%m-%d', d.created_at) <= '2019-10-10' ORDER BY d.id DESC ----------------------------------------------------------------- equipments-details-list ----------------------------------------------------------------- "SELECT e0_.inspection_date, e0_.id, e1_.equipment_name, e1_.equipment_type_id, e1_.equipment_year, e1_.equipment_make, e1_.equipment_model, e1_.serial_number, e1_.registration_number, e1_.comment, e1_.owner_status, e2_.equipment_type, e1_.working_status, e1_.vin, e1_.higgins_unit, e1_.higgins_tag, e1_.hrs_miles FROM equipment_projects e3_ LEFT JOIN equipments e1_ ON ( e1_.id = e3_.equipment_id ) LEFT JOIN equipment_types e2_ ON ( e2_.id = e1_.equipment_type_id ) LEFT JOIN equipment_inspection e0_ ON ( e0_.equipment_id = e1_.id AND e0_.id = (SELECT Max(e4_.id) AS sclr_18 FROM equipment_inspection e4_ WHERE e4_.equipment_id = e1_.id) ) WHERE e3_.project_id = 10 AND e3_.is_active = 1 AND e1_.equipment_make LIKE ? AND e1_.equipment_model LIKE ? AND e1_.equipment_type_id = ? AND e1_.equipment_year = ? AND e1_.owner_status = ? AND e1_.registration_number LIKE ? AND e1_.serial_number LIKE ? AND e1_.working_status = ? ORDER BY e1_.id DESC " ---------------------------------------------- equipment-type-list ----------------------------------------------- SELECT `id`, `equipment_type` from equipment_types equipments-inspection-list SELECT e0.id, e0.created_at, e0.inspection_date, e0.operator_name, e1.equipment_name FROM equipment_inspection e0 LEFT JOIN equipments e1 ON ( e1.id = e0.equipment_id ) WHERE e0.project_id = 10 AND e0.operator_name LIKE '%ew%' AND e1.equipment_name LIKE '%1990%' ORDER BY e0.id DESC -------------------------------------------------------------------------------------------------- filter-employee-form SELECT e0.id FROM equipment_inspection e0 LEFT JOIN equipments e1 ON ( e1.id = e0.equipment_id ) WHERE e0.project_id = 10 AND e0.operator_name LIKE '%ew%' AND e1.equipment_name LIKE '%1990%' ORDER BY e0.id DESC ------------------------- ids = e0.id -------------------------- SELECT e0.id, e0.first_name, e0.middle_name, e0.last_name FROM employees_projects e1 INNER JOIN employee e0 ON ( e0.id = e1.employee_id AND ( e1.status = 1 OR e1.status = 3 ) ) INNER JOIN operator_evaluation_form o2 ON ( e0.id = o2.employee_id AND o2.equipment_id IN ( 22, 23, 25, 28, 47 ) ) WHERE e0.deleted = 0 AND e0.status = 0 AND e1.project_id = 10 AND ( e0.first_name ||' '||e0.middle_name ||' '||e0.last_name) LIKE '%aron%' OR (e0.first_name ||' '||e0.last_name LIKE '%aron%' ) GROUP BY e0.id SELECT o0.id, e1.equipment_name FROM operator_evaluation_form o0 INNER JOIN equipments e1 ON ( e1.id = o0.equipment_id ) WHERE o0.employee_id = 375 ------------------------------------------------------------------------------------ ---------------------------------------------- hot-works-list ------------------------------------------------ SELECT h.id, h.created_at AS submit_time, h.hotworks_date AS site_audit_date FROM hot_works h WHERE h.project_id = 10 ORDER BY h.id DESC all-incident-list protective-equipments-details site-audit-list timesheet-list get-djha-data get-djha-form-status tool-box-talk-list -------------------------------------------------------- add-equipment INSERT INTO equipments (`id`,`equipment_type_id`,`equipment_year`,`equipment_make`,`equipment_model`,`serial_number`,`registration_number`,`comment`,`owner_status`,`vin`,`higgins_unit`,`higgins_tag`,`hrs_miles`,`working_status`,`equipment_name`) VALUES(null,'1','2019','tertret','dsfdsfds','sdfsdf','sdfdsf','sdfsdfds','sdfsdf','sdfdsfd','sdfdsfdsf','sdfsdfds','sdfsdf','sdfsdf','dsfdsfd','sdfsdfdsf')