News for hackers. Stuff that matters.
Re:Best practices for writing SQL queries by ianmcgowan on Saturday April 10, 2021 @07:11PM (#26766139)
I do this style too, but think of each new row as basically a new table being added to the query (especially if it's a query, which may go over several rows and is indented):

    from
      alpha a
      inner join beta b on b.id = a.id
      left outer join gamma g on g.id = a.id
      left outer join (
         select z.id, count(\*) as cnt from zeta z
      ) delta on delta.id = a.id
    where
      ...
Re:Best practices for writing SQL queries by mobjack on Saturday April 10, 2021 @08:17PM (#26766540)
That is my preferred style.

If there are many joins, I could also add more indention to show what is being joined to what.