title: MySQL first select column based on parameter value and then value of column
body: <p>I have a table lets say</p>
  
  <p><strong>Table1</strong></p>
  
  <pre><code>t_id A   B  C
  
  100  1   1  0
  
  101  1   0  1
  
  102  1   1  0
  </code></pre>
  
  <p>Now I have input parameter param0 based on which first I have to select column (lets say B) and then using t_id value(lets say 101) i will be selecting value of that selected column(which is 0).</p>
  
  <p>I want to create single query as i will be using it in join query.</p>
  
  <p>Is above possible, if yes how to write the sql for same?</p>