Earlier quoted context omitted.
I often do this with boolean WHERE filters when I'm doing interactive exploration on some data: SELECT ... WHERE foo = 1 AND bar = 2 I want to comment out a line (i.e. "--foo = 1"), but would break the syntax. The solution is to start with "WHERE true": SELECT ... WHERE true --AND foo = 1 AND bar = 2 Now you can comment/comment anything. (Putting the AND at end of each line has the same problem, of course, and requir…
God, everyone's going to hate me for this. (I will have earned it, I think.) SELECT ... WHERE foo = 1 AND bar = 2 Each keyword gets a new line, the middle gutter between keyword and expressions stays in the same place, and things get really, really fugly if I need a subselect or whatever. Any given line can be commented out. (And no, none of that leading comma bullshit, somehow that looks nasty to me.) Downvote this…
SELECT a, sum(b),
WHERE foo = 1
AND GROUP BY a
Sounds pretty SQL to me.