SELECT `a`.*, `b`.`name` as `branch_name`, `c`.`name` as `hod_name`
FROM `company__department` `a`
JOIN `company__branch` `b` ON `b`.`id` = `a`.`branch_id`
LEFT JOIN `user` `c` ON `c`.`id` = `a`.`hod_id`
WHERE `a`.`id` = '1'
AND `a`.`status` =0
AND `a`.`is_delete` =0
ORDER BY `a`.`name` ASC