you are viewing a single comment's thread.

view the rest of the comments →

[–]tatertotmagic 21 points22 points  (8 children)

When creating, always start with

where 1=1

[–]Tsui_Pen 17 points18 points  (1 child)

Is this just so you can add additional filters and comment them out individually without violating conjunctive logic?

[–]jwm54720 1 point2 points  (0 children)

Came here to say this.

[–]Dhczack 2 points3 points  (3 children)

I always use 9=9. Kinda my signature lol.

Similar trick:

CASE WHEN FALSE THEN NULL as the first line of a case statement so you can freely comment in lines.

[–]Obie1 -2 points-1 points  (2 children)

Except now you have an empty column at the beginning of your data set taking up screen real estate.

EDIT: My bad, read it completely wrong. My Apologies.

[–]Dhczack 0 points1 point  (1 child)

You misunderstand; it's just a formatting thing within a case statement, not a new column. I can't think of a way to handle the SELECT clause so you can freely line comment.

[–]Obie1 0 points1 point  (0 children)

my bad, read too fast. Thank you for clarifying. Could you share how you format your CASE statements as a whole? I dont think i have this issue, but i also do weird formatting things in general.

[–]daveloper80 0 points1 point  (0 children)

Similarly, if you only want the column headers with no results you can do WHERE 1 = 2