我希望我的表现像这样. [英] I want my out put to be like this.
本文介绍了我希望我的表现像这样.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
你好,
您能告诉我如何在一行中显示不同的行值吗?
假设我的输出是这样的:
Hello,
Can you tell me how to display different values of rows in one row.
Suppose my output is something like this:
id name marks
001 abc 23
001 abc 25
001 abc 20
001 abc 24
001 abc 28
002 def 19
002 def 25
002 def 26
我的预期输出是这样:
and my expected output is this:
id name marks
001 abc 23,25,20,24,28
002 def 19,25
003 acs 26,20,22
请告诉我如何编写过程查询..?
你能给我一个以上问题的例子吗?
[edit]已添加代码块,忽略HTML ..."选项已禁用-OriginalGriff [/edit]
Please tell me how do i write the procedure query..?
can you give me an example for the above question...??
[edit]Code block added, "Ignore HTML..." option disabled - OriginalGriff[/edit]
推荐答案
您需要一个PIVOT表:MSDN [
You need a PIVOT table: MSDN[^]
格里夫(Griff)是正确的.您也可以使用以下替代方法来做到这一点.
在SQL Server中透视数据 [
Griff is right. Also you can do that by using below alternate ways.
Pivoting data in SQL Server[^]
这篇关于我希望我的表现像这样.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文