title: Alter MySQL table column to match id's from another table
body: <p>Consider the following two MySQL tables:</p>
  
  <pre><code>companies
  -----------------------
  id ticker
  1  AA
  2  AAPL
  3  ABT
  4  AEP
  
  tweets
  -----------------------
  tweet_id query (etc...)
  1        $AA
  2        $AA
  3        $AAPL
  4        $ABT
  5        $AA
  6        $AEP
  7        $AEP
  </code></pre>
  
  <p>The table "companies" contains over 700 ticker symbols for various stocks. The table "tweets" contains millions of tweets. These tweets were gathered by querying Twitter.com for each ticker, prepended by "$", as this is the convention on Twitter when talking about a certain stock. I now would like to normalize the tweets table, as follows:</p>
  
  <pre><code>tweets
  -----------------------
  tweet_id query (etc...)
  1        1
  2        1
  3        2
  4        3
  5        1
  6        4
  7        4
  </code></pre>
  
  <p>So now, the tweet with tweet_id one was obtained by querying for ticker with id 1, being AA (the "$" is not necessary to store in the database anymore). Now my question would be: is there a way to update the query-column in the tweets-table with one sql-query? Your help would be greatly appreciated, since I see a lot of work ahead (by using PHP, perhaps) if this is not possible :)</p>