I have a table tmpZstock
with two columns: ZART_Article Code
(itemcode) and GERNR_SerialNO
(serialnumber):
CREATE TABLE tmpZstock (
[ZART_Article Code] INT,
GERNR_SerialNO INT
)
INSERT INTO tmpZstock ([ZART_Article Code], GERNR_SerialNO)
VALUES (200078, 126),
(200078, 127),
(200078, 128),
(200078, 129),
(200078, 130),
(200079, 131),
(200079, 132),
(200079, 133),
(200079, 134),
(200079, 135),
(200079, 136),
(200079, 137),
(200079, 138),
(200079, 139),
(200079, 140),
(200079, 141),
(200080, 142),
(200080, 143),
(200080, 144),
(200080, 145)
I need to create xml like this:
But when I write this query:
Select [ZART_Article Code] as ITEMCODE ,
(
Select SERIALS.[GERNR_SerialNO] as SERIALNO From tmpZstock SERIALS
where SERIALS.[ZART_Article Code]=T1.[ZART_Article Code] FOR XML rAW ('SERIALS'), TYPE )
From (select [ZART_Article Code] from tmpZstock group by [ZART_Article Code]) t1 FOR XML PATH('SERIALNUMBERDETAILS'), TYPE
,Root ('SUMMARY')
the result is:
I don't need the <SERIALS>
tag - how can I eliminate this tag from the result?