jdorn / sql-formatter

A lightweight php class for formatting sql statements. Handles automatic indentation and syntax highlighting.
http://jdorn.github.com/sql-formatter/
MIT License
3.89k stars 187 forks source link

Wrong indentation for more conditions in JOIN #87

Open nothrem opened 8 years ago

nothrem commented 8 years ago

When JOIN uses more conditions, it gets formatted as:

FROM 
    data as d
    JOIN more as m ON d.id = m.id
    AND d.name = m.name

Better would be (more compressed)

FROM 
    data as d
    JOIN more as m ON d.id = m.id AND d.name = m.name

or (less compressed)

FROM 
    data as d
    JOIN more as m 
        ON d.id = m.id 
        AND d.name = m.name