How the syntax of the clause (FOR XML PATH) is solved in postgres?

Viewed 7

I was trying to select all product code in one string separated by commas, but when I place the clause (FOR XML PATH ('') , the error appears as if the postrgres is not responding.

SELECT CONCAT(',' :: varchar , "PRODUCTCODE" :: varchar)
FROM "Sales_data"
WHERE "ORDERNUMBER" IN
(SELECT "ORDERNUMBER"
FROM (SELECt "ORDERNUMBER", COUNT(\*) rm
FROM "Sales_data"
WHERE "STATUS" = 'Shipped'
GROUP BY "ORDERNUMBER") AS m
WHERE rm = 2)
FOR XML PATH ('')

I am expecting to get one column contains one string stating all the product code numbers separated by Commas.

0 Answers
Related