News for hackers. Stuff that matters.
Re:Writing more legible SQL by rubyfan on Thursday November 03, 2016 @01:49AM (#12861871)
I go back and forth with conjunction at the end or beginning of the line. At the end you get to line up column names, at the beginning it makes it easier to comment out or remove the line and basically contains the intended logic on a single line.

I think I usually end up with the later because I think it makes more sense.

Re:Writing more legible SQL by berntb on Thursday November 03, 2016 @05:26AM (#12862526)
Why not this?

  WHERE A
    AND B
    AND C
Or better, this? You can comment out any part easily.

  WHERE 1
    AND A
    AND B
    AND C
(With keywords capitalized, as g-d intended. :-) Or not.)
Re:Writing more legible SQL by nerdponx on Thursday November 03, 2016 @07:02AM (#12862885)
I like the "WHERE 1" trick, thanks!
Re:Writing more legible SQL by bhrgunatha on Thursday November 03, 2016 @06:10AM (#12862693)
I have the same problem and also with where to put the commas separating columns names. You can't win the game though.

Sometimes you want to remove/comment out the first line, sometimes the last, sometimes one in the middle.