在“选择"列表中,如何在“垂直"中显示列 [英] In Select list how to show the columns in Vertical

查看:119
本文介绍了在“选择"列表中,如何在“垂直"中显示列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

SELECT [CaseLeadID]
     ,[Call1Date]
     ,[Call1Notes]
     ,[Call2Date]
     ,[Call2Notes]
     ,[Call3Date]
     ,[Call3Notes]
     ,[Call1Date]
     ,[Call1Notes]
     ,[Call2Date]
     ,[Call2Notes]
     ,[Call3Date]
     ,[Call3Notes]
 FROM tblCallCenterCalls 


对于上述查询,输出将为水平
但是我需要这样的输出


For the above query the output will be in horizontal
But i need output like this

CaseLeadID  CallType   CallDate     CallNote
1           Call1      02/02/2012     2
1           Call2      02/02/2012     2
3           Call1      02/02/2012     5
3           Call2      02/02/2012     5
3           Call3      02/02/2012     5


为此发布解决方案
提前致谢


Post Solution for this
Thanks In advance

推荐答案

您可以使用Pivot执行此操作.
请参阅
使用PIVOT和UNPIVOT [ SQL Server中的动态透视 [ sql-server-pivot-and-unpivot-table-examples [ ^ ]

更多CP文章此处 [
You can do this using Pivot.
Refer
Using PIVOT and UNPIVOT[^]
Dynamic Pivoting in SQL Server[^]
sql-server-pivot-and-unpivot-table-examples[^]

More CP articles here[^]




您可以使用数据透视表来实现.

请参阅下面的链接.这是例子.这样,您就可以实现所需的目标.

http://forums.asp.net/t/1775130.aspx/1 [ ^ ]

谢谢,
Viprat
Hi,

you can achieve this things using the pivot.

See the below link. Here is the example. So using that you can achieve desired things.

http://forums.asp.net/t/1775130.aspx/1[^]

Thanks,
Viprat


这篇关于在“选择"列表中,如何在“垂直"中显示列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆