title: mySQL - If statement giving syntax error
body: <p>So I have the following query:</p>
  
  <pre><code>IF ( ( SELECT RevisionNumber FROM SchemaVersion ) &gt; 1 ) THEN BEGIN
      CREATE TABLE Test ( ID INT );
      CREATE TABLE Test2 ( ID INT );
  END;
  END IF
  </code></pre>
  
  <p>Basically I want to decide based on a value in my table (SchemaVersion - always has 1 row) whether or not I need to make certain changes.</p>
  
  <p>However, when I use this query I get the following error message:</p>
  
  <pre><code>#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'IF ( ( SELECT RevisionNumber FROM SchemaVersion ) &gt; 1 ) THEN BEGIN
   CREATE T' at line 1
  </code></pre>
  
  <p>Any idea why this is erroring / how to fix?</p>
  
  <p>I was just reading another post and apparently <code>BEGIN</code> / <code>END</code> are only allowed within stored procs.  Is there any way to get around this (without putting it in a stored proc).</p>
  
  <p>Thanks</p>