I want to make a query in mySQL where I need to update "processes_handled" of department_table with the concatenated contents from "process_name" of process_table, if the department_name is included in the "departments_handling_the_process" field.
This is what my problem looks like:
department_table
department_name | processes_handled
Department 1 | Process A; Process B; Process D;
Department 2 | Process A; Process C: Process E; Process G;
Department 3 | Process C; Process D; Process F
process_table
process_name | departments_handling_the_process
Process A | Department 1; Department 2
Process B | Department 1
Process C | Department 2; Department 3
Process D | Department 1; Department 3
Process E | Department 2
Process F | Department 3
Process G | Department 2
my current update statement looks like:
UPDATE department_table,process_table
SET processes_handled= (SELECT GROUP_CONCAT(`process_name SEPARATOR '; ')
FROM process_table
WHERE CONTAINS(process_table.departments_handling_the_process, department_table.department_name))
WHERE CONTAINS(process_table.departments_handling_the_process, department_table.department_name)
;
I hope you can help me fix my statement. Thanks and more power!