SELECT * FROM a LEFT JOIN b ON a.x = b.x
LEFT JOIN b ON a.y = b.x
그런데 위와 같이 하면 b 가 이미 선언되어있어서, 안된다고 error 가 뜬다.
->
SELECT * FROM a LEFT JOIN b ON a.x = b.x
LEFT JOIN b AS c ON a.y = c.x
->
실 사용:
select p.title AS q_title, p.cont AS q_cont , p1.title AS a_title, p1.cont AS a_cont FROM play.Fn_contact(@xfnContactKey) as p
left join play.Fn_contact(@xfnContactKey) as p1
on p.idx = p1.parent_id where p.idx = Cast(@sIdx AS INT)