title: Is there a better way to dynamically build an SQL WHERE clause than by using 1=1 at its beginning?
body: <p>I'm building some <a href="http://en.wikipedia.org/wiki/SQL">SQL</a> query in C#. It will differ depending on some conditions stored as variables in the code.</p>
  
  <pre><code>string Query="SELECT * FROM Table1 WHERE 1=1 ";
  if (condition1) 
      Query += "AND Col1=0 ";
  if (condition2) 
      Query += "AND Col2=1 ";
  if (condition3) 
      Query += "AND Col3=2 ";
  </code></pre>
  
  <p>It works, but testing 1=1 doesn't seem elegant. If I didn't use it, I would have to remember and check every time if "where" keyword was already added or not to the query.</p>
  
  <p>Is there a nicer solution?</p>