2015-10-20 71 views
-3

问题陈述:无法得到期望的结果集SQL

在SQL中我试图让使用数据透视查询图像2中提到的结果集,但我没有得到期望的结果如果有人提出建议,那将会很棒。

图像1:(当前结果集)

enter image description here

镜像2:所需的输出

enter image description here

+0

我删除了无关的数据库标记。随意添加您实际使用的* one *数据库。您还应该显示您尝试过的任何查询。 –

+1

另一个“读我的想法”的问题?为什么期望的输出是理想的?你有什么尝试?什么没有奏效 ? –

+0

什么是输入? –

回答

1

你可以group by COL1。

select col1, max(col2), max(col3), max(col4), max(col5) 
from tablename --or query that produces the current resultset 
group by col1 
+0

Thanx,它的工作 –