从两行检索数据并将其显示在一行中 [英] Retrieving data from two row and showing it in one row
本文介绍了从两行检索数据并将其显示在一行中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
嗨
我有一种情况需要从两个不同的行中取相同单元格的值
表结构
Hi
I have a situation where i need to take the value from same cell in two different rows
Table Structure
ID|T_ID|Value
--|----|------
1 | 7 | 15
--|----|------
2 |7 | 19
--|----|----
3 |12 | 24
输出
Output
T_ID|Value1|value2
----|------|-------
7 | 15 | 19
----|------|-------
谢谢和问候
VRN
thanks and regards
VRN
推荐答案
你可以使用数据透视表,
在SQL查询中使用Pivot的简单方法 [< a href =http://www.codeproject.com/Tips/500811/Simple-Way-To-Use-Pivot-In-SQL-Querytarget =_ blanktitle =New Window> ^ ]
http://technet.microsoft.com/en-us/library/ms177410%28v=sql.105%29.aspx [ ^ ]
You can use pivot table for that ,
Simple Way To Use Pivot In SQL Query[^]
http://technet.microsoft.com/en-us/library/ms177410%28v=sql.105%29.aspx[^]
这篇关于从两行检索数据并将其显示在一行中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文