Outer Join
TABLE testF
acol bcol
1 2
1 3
3 2
1 3001
TABLE testZ
bcol ccol
2 2
3 2
Inner join : testF-testZ on bcol column
select a.*,b.bcol as result from testF a
inner join testZ b
on a.bcol = b.bcol
acol bcol result
1 2 2
1 3 3
3 2 2
Will be result ,
Outer join : testF-testZ on bcol column – check isnull
MySQL/MSSQL 공통 방식
select a.*,
CASE
WHEN b.bcol IS NULL THEN 0
ELSE 1
END
from testF a
left outer join testZ b
on a.bcol = b.bcol
acol bcol (No column name)
1 2 1
1 3 1
3 2 1
1 3001 0
MSSQL 방식 : isnull
select a.*,
CASE isnull(b.bcol, 0)
WHEN 0 THEN 0
ELSE 1
END
from testF a
left outer join testZ b
on a.bcol = b.bcol
acol bcol (No column name)
1 2 1
1 3 1
3 2 1
1 3001 0
'온라인게임' 카테고리의 다른 글
Scale Form 스케일 폼 적용 사례 .... (0) | 2011.05.13 |
---|---|
컴투스 게임빌 2011 1분기 실적 (0) | 2011.05.13 |
스마트폰 게임 순위 (0) | 2011.04.29 |
A cursor with the name ... already exists (0) | 2011.04.22 |
physics editor / cocos2d , box2d / iphone (0) | 2011.04.14 |