title: mySQL If statement
body: <p>I am trying to make this If Statement work, but I can't seem to make it do what I want. If I do a select @result, It'll give me the value 0, then why doesn't the IF statement work?</p>
  
  <pre><code>SET @message = '((sometihng here))';
  select LEFT(@message, 1) into @firstChar;
  select STRCMP(@firstChar,'(') into @result;
  IF (@result = 0) THEN  
  SET @message = 'true';
  //more selects and cals here;
  END IF;
  select @message;
  </code></pre>
  
  <p>I should get true, but I don't it shows me an error:</p>
  
  <blockquote>
    <p><code>SQL query:  IF( @result =0 ) THEN SET @message = 'true';</code></p>
  </blockquote>
  
  <p>MySQL said:  </p>
  
  <blockquote>
    <p>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 (@result = 0) THEN   SET @message = 'true'' at line 1</p>
  </blockquote>