FULL OUTER JOIN not wrapping correctly

a.higginsa.higgins Posts: 90 Bronze 2
edited August 30, 2016 3:20PM in SQL Prompt
When I use a FULL OUTER JOIN in my code, it appears not to correctly associated the "FULL" keyword with the rest of the JOIN. The problem doesn't seem to apply to any of the other JOIN types.

Starting code:
;WITH a AS (SELECT 1 AS x)
SELECT *
FROM a 
	FULL OUTER JOIN a a2 ON a.x = a2.x
	LEFT OUTER JOIN a a3 ON a.x = a3.x
	RIGHT OUTER JOIN a a4 ON a.x = a4.x

After formatting:
;WITH a AS
(
	SELECT 1 AS x
)
SELECT
	a.x
   ,a2.x
   ,a3.x
   ,a4.x
FROM a FULL
	OUTER JOIN a a2
		   ON a.x = a2.x
	LEFT OUTER JOIN a a3
		ON a.x = a3.x
	RIGHT OUTER JOIN a a4
		ON a.x = a4.x

Notice that the LEFT and RIGHT keywords are on the same line as the OUTER JOIN syntax, but the FULL keyword is left hanging out on the line above, and the ON is weirdly indented.


Expected result after formatting:
;WITH a AS
(
	SELECT 1 AS x
)
SELECT
	a.x
   ,a2.x
   ,a3.x
   ,a4.x
FROM a 
	FULL OUTER JOIN a a2
		ON a.x = a2.x
	LEFT OUTER JOIN a a3
		ON a.x = a3.x
	RIGHT OUTER JOIN a a4
		ON a.x = a4.x

This would make the formatting of FULL OUTER JOIN consistent with the rest.

Comments

Sign In or Register to comment.