내가왼쪽 외부 조인과 조인의 차이점은 무엇입니까? 아래 쿼리
select a.strAssociateId,
a.strAssociateName,
a.strPhoto, isnull(sum(iCount),0) as zypcoins
from CIOChallenge_tbl_Associates a
left outer join CIOChallenge_tbl_AssociatePoints ap
on
a.strAssociateId=ap.strAssociateId
and
ap.iRewardId=1
where iRoleId=(select iRoleId from CIOChallenge_tbl_Roles where strRoleDescription like '%student%')
group by a.strAssociateId,
a.strAssociateName,
a.strPhoto
select a.strAssociateId,
a.strAssociateName,
a.strPhoto,
isnull(sum(iCount),0) as zypcoins
from CIOChallenge_tbl_Associates a
join CIOChallenge_tbl_AssociatePoints ap
on
a.strAssociateId=ap.strAssociateId
and
ap.iRewardId=1
where iRoleId=(select iRoleId from CIOChallenge_tbl_Roles where strRoleDescription like '%student%')
group by a.strAssociateId,
a.strAssociateName,
a.strPhoto
여기
내가 외부 조인 왼쪽 사용 내가이 쿼리는 또한 위의 차이를 알 수있다 (필자는이 모든 학생들 Zypcoins을받을 필요)에 가입 사용 거기에 학생 zypcoins을 얻을 수있는 다른 방법
모든 학생이 해당 표에 점수가없는 경우 차이가 있음을 알 수 있습니다. 내부 조인은이 항목을 제거하지만 외부 조인은 NULL을 채 웁니다. – keltar
오! 좋아, 의견을 주셔서 감사합니다 Ketlar :) –
이러한 차이점에 대한 훌륭한 설명은 [SQL JOIN의 시각적 설명] (http://blog.codinghorror.com/a-visual-explanation-of-sql-joins/)을 참조하십시오. . –