我有一个sql请求,在这个请求中我使用函数组\u concat。我用这个在每一行有一个delegue列表。
这是我的要求:
SELECT pro.company, pro.title AS person_title, pro.name AS person_name, pro.firstname AS person_firstname, pro.address, pro.address2, pro.postcode, cities.name AS city, pro.phone, pro.gsm, pro.fax, pro.email, pro.client_number AS sap, GROUP_CONCAT( DISTINCT user.firstname, ' ', user.name SEPARATOR ', ') AS delegue, agency.name AS agency, CONCAT(drv.firstname, ' ', drv.name) AS drv_name, drv.email AS drv_email, GROUP_CONCAT(DISTINCT pc.competence_id SEPARATOR ',') AS competences
FROM velux.professionnal pro
INNER JOIN velux.cities ON cities.id = pro.city_id
INNER JOIN velux.zone ON pro.postcode BETWEEN zone.postcode_start AND postcode_end
LEFT JOIN velux.p2p_user_zones user_zones ON user_zones.zone_id = zone.id
LEFT JOIN velux.p2p_user user ON user.id = user_zones.user_id
left join velux.p2p_user_group on p2p_user_group.user_id = user.id
LEFT JOIN velux.agency ON zone.agency_id = agency.id
LEFT JOIN velux.p2p_user drv ON drv.id = agency.user_id
LEFT JOIN velux.professionnal_competence pc ON pc.professionnal_id = pro.id
WHERE p2p_user_group.group_id in (10, 3)
GROUP BY pc.professionnal_id
我的问题是,在我的记录的第一行,delegue列的结果太多了:(。但另一排没关系。我不知道这个错误是什么,也不知道如何解决它。
有人有主意吗?如果是,那就太好了!提前谢谢!
暂无答案!
目前还没有任何答案,快来回答吧!