How to concatenate text from multiple rows into a single text string in SQL server?
SELECT DISTINCT SBM.Barcode_Autogen_No,
SUBSTRING(
(
SELECT Barcode_No_Char AS [text()]
FROM FP_Stock_Barcode_Details SBD
WHERE SBM.Barcode_Autogen_No = SBD.Barcode_Autogen_No
ORDER BY SBM.Barcode_Autogen_No
FOR XML PATH ('')
), 2, 1000) [Students]
FROM FP_Stock_Barcode_Details SBM
No comments:
Post a Comment