Привет, у меня есть таблица, называемая отделом, и я показываю отчет, основанный на посещаемости, и мне нужно объединить всех работодателей в отделе с соответствующим отделом.Например: отдел 1 => 1,2,3 и отдел2 => 4,5,6 .i попробовал группировать, но это объединяет всех работодателей, имеющих определенный отдел, то есть depatment1 содержит только 3, когда я использовал groupby.Есть ли в php функция для получения уникальных данных при извлечении
[0] => Array
(
[department_id] => 15
[department_name] => R&D
[name] => SUBRAMANIAN
[code] => 101
[clockin] =>
[late] =>
[date] => 1970-01-01
)
[1] => Array
(
[department_id] => 3
[department_name] => Manufacturing
[name] => RAVI
[code] => 103
[clockin] =>
[late] =>
[date] => 1970-01-01
)
[2] => Array
(
[department_id] => 3
[department_name] => Manufacturing
[name] => AMULRAJAN.A
[code] => 104
[clockin] =>
[late] =>
[date] => 1970-01-01
)
[3] => Array
(
[department_id] => 3
[department_name] => Manufacturing
[name] => KANAKARAJ.R
[code] => 105
[clockin] =>
[late] =>
[date] => 1970-01-01
)
[4] => Array
(
[department_id] => 3
[department_name] => Manufacturing
[name] => ELAYARAJA
[code] => 106
[clockin] =>
[late] =>
[date] => 1970-01-01
)
[5] => Array
(
[department_id] => 3
[department_name] => Manufacturing
[name] => SIVAKUMAR.T
[code] => 108
[clockin] =>
[late] =>
[date] => 1970-01-01
)
[6] => Array
(
[department_id] => 3
[department_name] => Manufacturing
[name] => PALANISAMY.R
[code] => 110
[clockin] =>
[late] =>
[date] => 1970-01-01
)
[7] => Array
(
[department_id] => 3
[department_name] => Manufacturing
[name] => SAKKIYAN.K
[code] => 112
[clockin] =>
[late] =>
[date] => 1970-01-01
)
[8] => Array
(
[department_id] => 3
[department_name] => Manufacturing
[name] => Jeyaprakash
[code] => 113
[clockin] =>
[late] =>
[date] => 1970-01-01
)
Мне нужен отдел -> Производство содержит RAVI, AMULRAJAN.A, KANAKARAJ.R и т. Д., Не объединять его при использовании groupby
Этомой запрос MySQL:
SELECT `tbl_employee_basicdetails`.`employee_id`, `tbl_employee_basicdetails`.`employee_name`, `tbl_employee_basicdetails`.`employee_code`, `tbl_employee_officedetails`.`department` FROM `tbl_employee_basicdetails` JOIN `tbl_employee_officedetails` ON `tbl_employee_officedetails`.`employee_id`=`tbl_employee_basicdetails`.`employee_id` WHERE `tbl_employee_basicdetails`.`employee_act` = 1