Ich plane, COALESCE in meinem Problem zu verwenden. Alles, was ich will, ist, Werte durch Kommata getrennt in einer einzigen Spalte zu haben. hier ist meine Aussage:Wie verwendet man COALESCE in einer inneren Join-Anweisung in SQL
select p.[name], cd.CustomerName, cd.CustomerEmailID
,cd.CustomerPhoneNo,cd.CustomerAddress
,cd.TotalPrice,cd.OrderDateTime, cd.PaymentMethod
FROM CustomerDetails cd
Inner Join CustomerProducts cp ON cp.CustomerID = cd.Id
Inner Join Products p ON cp.ProductID = p.ProductID
und es gibt mir diese
jetzt ich die Produktsäule wollen ein Ergebnis von
carbon dioxied,industrial oxygen
haben, da sie in die gleiche ID.
bitte helfen Sie mir aus. vielen Dank
UPDATE: aktuelle Anweisung, aber immer noch gibt mir das gleiche Ergebnis.
use ShoppingCartDB
select
STUFF((SELECT ',' + p.[name]
FROM Products p
WHERE cp.ProductID = p.ProductID
FOR XML PATH(''),TYPE).value('.','nvarchar(max)'),1,1,'') AS Name
, cd.CustomerName, cd.CustomerEmailID
,cd.CustomerPhoneNo,cd.CustomerAddress
,cd.TotalPrice,cd.OrderDateTime, cd.PaymentMethod
FROM CustomerDetails cd
Inner Join CustomerProducts cp ON cp.CustomerID = cd.Id
Aktivieren Sie diese bitte; [link] (http://stackoverflow.com/questions/28986135/concatenate-fields-of-rows-with-the-same-id-in-mysql) – Berkay
Meinst du 'GROUP_CONCAT'? http://dev.mysql.com/doc/refman/5.7/en/group-by-functions.html#function%5Fgroup-concat – ck1
hallo concat ist nicht anerkannt, ich weiß nicht, warum –