我有以下(有点长)查询:
SELECT *
FROM client C
JOIN uga U
ON U.id_uga = C.id_uga
JOIN appartenance A
ON A.id_uga = U.id_uga
JOIN serviceattribuee SA
ON SA.id_client = C.id_client
JOIN service S
ON S.id_service = SA.id_service
WHERE A.id_utilisateur = 28
ORDER BY ville_client
这让我返回了类似的东西:
Nom : "Test"
Adresse : "Test"
Services : "Service 1"
Nom : "Test"
Adresse : "Test"
Services : "Service 2"
Nom : "Test 2"
Adresse : "Test 2"
Services : "Service 1"
Nom : "Test 2"
Adresse : "Test 2"
Services : "Service 2"
如您所见,结果是重复的,因为每个客户端都有多个服务。有没有办法将每个客户端的所有服务连接到同一行,以避免双打?
我正在使用 MySQL5.5
谢谢 !