来自数据透视表格格式的数据 [英] Data from Datatable in Pivot Format
问题描述
嗨专家
我在DataTable中有数据,包括3个字段firstname,lastname,emailid
firstname lastname emailid
abc abc1 ---
xyz xyz1 ---
lmn lmn1 ---
现在我想以数据格式从数据表中检索数据并附加到这样的网格
firstname abc xyz lmn
lastname abc1 xyz1 lmn1
emailid --- --- ---
如何实现这个
任何帮助都会得到极大的赞赏
谢谢
Shafi
Hi Experts
I have Data in DataTable with 3 fields firstname,lastname,emailid
firstname lastname emailid
abc abc1 ---
xyz xyz1 ---
lmn lmn1 ---
Now i want to retrieve the data from datatable in pivot format and attach to grid like this
firstname abc xyz lmn
lastname abc1 xyz1 lmn1
emailid --- --- ---
how to acheive this
Any Help Would Be Greatly Appreciated
Thanks
Shafi
推荐答案
了解 SQL PIVOT :
MSDN:使用PIVOT和UNPIVOT [ ^ ]
了解PIVOT和UNPIVOT [ ^ ]
在SQL Server中透视数据 [ ^ ]
试用!如果您遇到任何问题,请发布具体问题。
Read about SQL PIVOT:
MSDN: Using PIVOT and UNPIVOT[^]
Understanding PIVOT and UNPIVOT[^]
Pivoting data in SQL Server[^]
Try out! Post specific issue if you face any.
这篇关于来自数据透视表格格式的数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!