mysql一對多關系,將多條組成一條並顯示全部內容(group_concat()方法與group by並用)
mysql 一對多關系,將多條組成一條並顯示全部內容(group_concat()方法與group by並用):
例如:將專傢技術方向表根據專傢Id分組,並顯示該專傢的全部技術方向信息。
select sbes.expert_id,group_concat(sbes.skill_direction) as skillDirectionStr from shtic_base_expert_skill sbes where sbes.flag = 0 group by sbes.expert_id