sql 以逗号分割成多行数据
-- 切割前 --1 pt19050108243898962 79 3689.0000 05296,05894,05927 --切割后 --pt19050108243898962 79 3689.0000 05296 --pt19050108243898962 79 3689.0000 05894 --pt19050108243898962 79 3689.0000 05927 SELECT OrderId,ActivityId,GroupGoodsMoney,B.value FROM ( SELECT OrderId,ActivityId,GroupGoodsMoney, GoodsSup = CONVERT(xml,'<root><v>' + REPLACE(GoodsSup, ',', '</v><v>') + '</v></root>') FROM shop_OrderActivityGoods ) A OUTER APPLY ( SELECT value = N.v.value('.', 'varchar(100)') FROM A.GoodsSup.nodes('/root/v') N(v) ) B
不要看他人高新,且看闲时谁在拼