0

我有两张桌子。假设business_type_mastercontact_master。的主键以逗号分隔值business_type_master输入表中,如.contact_master2,3,4

现在我要加入这些表并使用GROUP_CONCAT. 但它不会返回所需的输出。我的输出将是这样的

  • business_type_id==>2,3,4
  • business_name ==>A,B,C

但我的输出如下

  • business_type_id==>2,3,4
  • business_name==>A

我的查询是

SELECT cm.contact_id, cm.full_name, 
  GROUP_CONCAT(cm.business_id) AS business_type_id,             
  GROUP_CONCAT(btm.business_type_name) AS business_type_name 
FROM contact_master AS cm           
JOIN business_type_master AS btm ON cm.business_id = btm.business_type_id 
GROUP BY cm.contact_id

有人可以帮忙吗?

4

0 回答 0