The group_concat () function of MYSQL combines multiple rows and the same field data into a data table. The SQL code of the access group table is select a. t_applypersondocno, a. t_id from sx_fms_taskinfo a www.2cto.com.
SQL code select * from sx_fms_taskinfoid_countryid result set
Data Table Country info table SQL code select c_id, c_name from sx_fms_countryinfo www.2cto.com result set is associated and then the visited countries are combined (before the combination)
SQL code select taskinfo. t_applypersondocno, countryinfo. c_name from sx_fms_taskinfo taskinfo left join sx_fms_taskinfoid_countryid tcinfo on taskinfo. t_id = tcinfo. t_id left join sx_fms_countryinfo countryinfo on tcinfo. c_id = countryinfo. the c_id is associated before the combination, and then the visiting countries are combined (after the combination) using group_concat (c_name)
SQL code www.2cto.com select taskinfo. t_applypersondocno, group_concat (c_name) from sx_fms_taskinfo taskinfo left join sx_fms_taskinfoid_countryid tcinfo on taskinfo. t_id = tcinfo. t_id left join sx_fms_countryinfo countryinfo on tcinfo. c_id = countryinfo. c_id group by taskinfo. after the t_applypersondocno combination