title: use the If else condition for selecting the column in mysql?
body: <p>I am having two tables like this.Both are separate tables</p>
  <pre><code>AccountNo       User         Name
  ----------------------------------
   1               U            a
   2               U            b
   3               U            c
  </code></pre>
  <p>And another table contains the following structure</p>
  <pre><code> TempAccountNo       Mycolumn    AccountNo     
  ------------------------------------------
   4               X                2341
   5               Y                 2
   6               Z                2568
  </code></pre>
  <p>I need to select the   AccountNo or TempAccountNo,Mycolumn From table II and the condition is</p>
  <pre><code>If (tableII.AccountNo not in table I)
  
     I need to choose `TempAccountNo from table II`
  
  else
    I need to choose `AccountNo from table II`
  </code></pre>
  <p>How can I achieve this.</p>