title: MySQL join select on two different database tables
body: <p>Beginner here. I want to join two tables that resides in two different databases. 
  Let's say:</p>
  
  <pre><code>Database 1 name is: a_database
  Database 2 name is: b_database
  </code></pre>
  
  <p>a_database table name is: coupons 
  and columns are: <code>id|coupon|created_at</code>
  b_database table name is: partner_company_clients 
  and columns are: <code>id|phone|coupon_id|created_at</code></p>
  
  <p>The query is: </p>
  
  <pre><code>SELECT * 
  FROM b_database.partner_company_clients pcc
  INNER JOIN (SELECT id, coupon from a_database.coupons) mac on 
  mac.id=pcc.coupon_id
  WHERE pcc.partner_company_id=1 
  AND pcc.deleted_at IS NOT NULL;
  </code></pre>
  
  <p>This works perfectly fine. But I do not want to pull everything from b_database.partner_company_clients table. Only the phone number column. 
  If I remove the * and specify the column names it throws an error. I can't say why.</p>
  
  <p>The select query becomes:  </p>
  
  <pre><code>SELECT id, phone 
      FROM b_database.partner_company_clients pcc
      INNER JOIN (SELECT id, coupon from a_database.coupons) mac on 
      mac.id=pcc.coupon_id
      WHERE pcc.partner_company_id=1 
      AND pcc.deleted_at IS NOT NULL;
  </code></pre>
  
  <p>Error:</p>
  
  <blockquote>
    <p>Error: #1052 - Column 'id' in field list is ambiguous</p>
  </blockquote>