2013-05-28 3 views
0

누구나 내가 두 행 값, 한 행에 두 개의 다른 열 값을 표시 할 수있는 방법을 말해 줄 수있는 두 개의 열. 하나에 두 행 값

Test ID  Total Employees Response Score  Eval Score 
1    7     4.24    0 
1    7      0    4.78 
2    13     4.52    0 
2    13      0    4.89 


그래서 내가 출력을 찾고 :


Test ID  Total Employees Response Score  Eval Score 
1    7     4.24    4.78 
2    13     4.52    4.89 

답변

4

당신은으로 집계 함수를 사용할 수 있습니다 아래의 표입니다 GROUP BY 결과를 얻으려면 :

select TestId, 
    totalEmployees, 
    max(ResponseScore) responseScore, 
    max(EvalScore) EvalScore 
from yourTable 
group by TestId, totalEmployees; 
+0

정말 바보 같아요. ... 고마워요 !!!!!!!!!!! –

4
select [Test ID], 
     [Total Employees], 
     max([Response Score]) as [Response Score], 
     max([Eval Score]) as [Eval Score] 
from your_table 
group by [Test ID], [Total Employees] 
+0

답장을 보내 주셔서 감사합니다! –

관련 문제