2017-12-13 15 views
0

나의 첫 번째 선택 문의 결과입니다 결합 도움이 필요두 SELECT 문

select cRefNum, LISTAGG(fname|| ' ' || lname, ', ') within group (order by cRefNum) as Teachers 
from teachers 
where cRefNum = 3816 
group by cRefNum; 

결과는 다음과 같습니다.

내가 달성하기 위해 노력하고있어 691,363,210

query 2 result

은 다음과 같습니다이 그것을 수정하지만 정말 길고 내가 그것을 단축 충분히 모르는

enter image description here

답변

0
select a.cRefNum, cName, CourseDesc, cTimeStart, cTimeEnd, cDay, Campus, Room, cSchedType, Teachers 
from 
(select cRefNum, cName, cProgram || '-' || cCode || '-' || cSection as CourseDesc, cTimeStart, cTimeEnd, cDay, ct.cCampus as Campus, cBuildingSection || cRoom AS Room, cSchedType from coursedetails cd inner join coursetimes ct using (cRefNum) where cRefNum = 3816) a, 
(select cRefNum, LISTAGG(fname|| ' ' || lname, ', ') within group (order by cRefNum) as Teachers from teachers where cRefNum = 3816 group by cRefNum) b 
where a.cRefNum = b.cRefNum; 

.