title: mysql query error 1054 - unknown column
body: <p>I failed to run a query in mysql. Deliberately I dont want to do <code>select id from roles</code>...</p>
  
  <p>the query</p>
  
  <pre><code>select rtu.role_id
  from roles r 
  where id =(select role_id 
             from roles_to_user rtu 
             where user_id=1)
  </code></pre>
  
  <p>error</p>
  
  <pre><code>ERROR 1054 (42S22): Unknown column 'rtu.role_id' in 'field list'
  </code></pre>
  
  <p>desc roles_to_user:</p>
  
  <pre><code>+---------+---------+------+-----+---------+-------+
  | Field   | Type    | Null | Key | Default | Extra |
  +---------+---------+------+-----+---------+-------+
  | user_id | int(11) | NO   | PRI | NULL    |       |
  | role_id | int(11) | NO   | PRI | NULL    |       |
  +---------+---------+------+-----+---------+-------+
  </code></pre>
  
  <p>desc roles:</p>
  
  <pre><code>+-------+-------------+------+-----+---------+----------------+
  | Field | Type        | Null | Key | Default | Extra          |
  +-------+-------------+------+-----+---------+----------------+
  | id    | int(11)     | NO   | PRI | NULL    | auto_increment |
  | name  | varchar(80) | NO   |     | NULL    |                |
  +-------+-------------+------+-----+---------+----------------+
  </code></pre>