title: MySQL Subquery IN results
body: <p>I want to use ids from query on my_table to select all field_b rows from my_table_2.</p>
  
  <pre><code>  SELECT field_b
    FROM my_table_2
    WHERE my_id_2 IN (
           SELECT my_id FROM my_table WHERE field_a = 1234
    );
  </code></pre>
  
  <p>I get <code>ERROR 1054 (42S22): Unknown column 'my_id_2' in 'IN/ALL/ANY subquery'</code> executing the above query.</p>
  
  <p>Below are example of my tables for reference:</p>
  
  <pre><code>  mysql&gt; select * from my_table;
      +-------+---------+
      | my_id | field_a |
      +-------+---------+
      |     1 |    1234 |
      +-------+---------+
      |     2 |    1234 |
      +-------+---------+
      2 row in set (0.00 sec)
  
  mysql&gt; select * from my_table_2;
  +-------+-----------+
  | my_id_2 | field_b |
  +---------+---------+
  |     1   |  5678   |
  +-------+-----------+
  1 row in set (0.00 sec)
  </code></pre>