我有一个存储过程
SELECT P.Name,P.Description,
PP.Attribute,PD.Value
FROM admin.Profiles P
LEFT JOIN admin.ProfilePreferenceMap PPM on P.ProfileID=PPM.ProfileID
LEFT JOIN admin.ProfilePrefDtl PD on PD.ProfilePrefDtlID=PPM.PreferenceID
LEFT JOIN admin.ProfilePref PP on PP.ProfilePrefID=PD.ProfilePrefID
WHERE P.Name='Profile1'
它返回像
Name Description Attribute Value
Profile1 Profile 1 description E EV
Profile1 Profile 1 description S SV
我想得到结果
Name Description Attribute Value
Profile1 Profile 1 description E,S EV,SV
我的目的是将此值转换为 JSON 数据,例如 -
[{"Name":"Profile1","Description":"Profile 1 description","Attribute":["E", "S"],"Value":["EV", "SV"]}]