SQL Group By And Group_Concat Exapmle

SELECT       
SUBSTRING((SELECT ', ' + CAST([קוד זיהוי] AS VARCHAR(20))  FROM [dbo].[All] AllSub
     WHERE AllSub.משפחה = AllMain.משפחה
     For XML Path('')), 2, 8000) AS [קוד זיהוי]
    
FROM [dbo].[All] AllMain
GROUP BY משפחה, [שם] ,[רחוב] ,[מספר בית], [עיר];

point is that whatever field that is not in the GROUP BY the SQL Server wants you to group it somehow, and you need to to this XML trick for each one.
 

Comments

Popular posts from this blog

OverTheWire[.com] Natas Walkthrough - JUST HINT, NO SPOILERS

Asp.Net Ending Response options, Response.End() vs CompleteRequest()

SOLVED The item could not be indexed successfully because the item failed in the indexing subsystem