SELECT vchBoxNumberNew,
data=STUFF((SELECT ‘;‘+vchBloodNo FROM dbo.tbPlasma WHERE vchBoxNumberNew=a.vchBoxNumberNew FOR XML PATH(‘‘)), 1, 1, ‘‘)
FROM dbo.tbPlasma a
where vchBoxNumberNew=‘2014HL000001‘
GROUP BY a.vchBoxNumberNew
with tmpTable as
(
SELECT vchBoxNo,CAST(‘<i>‘ + REPLACE(vchBloodNos, ‘;‘, ‘</i><i>‘) + ‘</i>‘ AS XML) AS KID
FROM dbo.tbBox
where vchBoxNo=‘2014HL000001‘
)
select vchBoxNo,x.i.value(‘.‘, ‘VARCHAR(10)‘) AS vchBloodNo
from tmpTable
CROSS APPLY KID.nodes(‘i‘) x(i)
where len(x.i.value(‘.‘, ‘VARCHAR(10)‘))<>‘‘
时间: 2024-10-29 11:27:41