Format Join Order
On our team we are very particular about the order of our joins as they are written in the query. I would like to request an option to format joins so the table you are joining on is the first item in the join. In the example below you join to tableb so the first ON clause is tableb, subsequently on the tablec join the first join is on objects from tablec.
SELECT (columns)
FROM tablea a
INNER JOIN tableb b ON
a.id = b.id
INNER JOIN tablec c ON
b.id2 = c.id
To:
SELECT (columns)
FROM tablea a
INNER JOIN tableb b ON
b.id = c.id
INNER JOIN tablec c ON
c.id = b.id2
-
Ingemar Magnusson
commented
When typing queries there is an option "Swap order of columns in join clauses" and we are able to choice our preferred order of columns in the suggestion.
I would like, and I think this is what is requested here, the same option in the formatting styles to be able to set order of columns in join clauses when formatting an SQL.
-
Gert Hauan
commented
I think you have a typo in your To: query? I cannot see that you are joining to anything in tablea in that query`?
If that is correct,and it is only a typo, then I think this feature already exists. look under Join conditions in the Options, there is under Column order a setting for "Swap order of columns in join clauses"