如何在SQL Server中将多行合并为单行
你好,
我有一个delima,我不确定这是否可行.但我有一张桌子,可以说
年龄|类型名称|剂量
1药x 1毫升
2疫苗y 2毫升
3水z 3ml
1支疫苗4毫升
2药e 5毫升
我希望能够将此数据作为一行与data1中的数据返回一列,并以逗号分隔.
因此结果将是
1列
年龄类型名称剂量
1个Medix,疫苗x,1ml,4ml
如何用于xmlpath()
谁能帮我这个忙.
谢谢您,
Hello,
I have a delima, and i am not really sure if this possible. But i have a table like lets say
age | type | name | dose
1 medicine x 1ml
2 vaccine y 2ml
3 water z 3ml
1 vaccine a 4ml
2 medicine e 5ml
i want to be able to return this as one row with the data from data1 in one column separated by commas.
so the result would be
1 Column
age type name dose
1 medi,vaccine x,a 1ml,4ml
how to use for xmlpath()
can anyone help me with this.
Thank you,