title: WHERE statement with duplicate column names over JOIN - PostgreSQL
body: <p>I am trying to join two tables, a <strong>plans</strong> table and a <strong>plan_details</strong> table. Below are two examples of what the tables look like.</p>
  
  <p><strong>PLANS Table</strong> </p>
  
  <pre><code>+---------+------+-----------+
  | user_id | plan | is_active |
  +---------+------+-----------+
  |  1      |  10  |    true   |
  |  1      |  11  |   false   |
  |  2      |  11  |    true   |
  </code></pre>
  
  <p><strong>PLAN_DETAILS Table</strong></p>
  
  <pre><code>+---------+------+-------+-----------+
  | plan_id | cost | price | is_active |
  +---------+------+-------+-----------+
  |  10     |  19  |  199  |    true   |
  |  11     |  13  |  149  |    true   |
  </code></pre>
  
  <p>I only want to only pull the active plan <em>cost</em> and the <em>price</em> related to each user. Right now, my knex statement is:</p>
  
  <pre><code>knex('plans')
    .where({
      user_id: 1,
      is_active: 'true'
    })
    .select(
      'plans.plan',
      'plan_details.cost',
      'plan_details.price'
    )
    .join('plan_details as plan_details', 'plan_details.plan_id', 'plans.plan')
    .then(function (user_plan_id) {
      console.log(user_plan_id);
    });
  </code></pre>
  
  <p>Now if I keep the <code>is_active: 'true'</code> in there then I get a <code>Unhandled rejection error: column reference "is_active" is ambiguous</code>. If I take out the is_active part, well then I get information for both of the plans that reference the user even though I only want the info regarding which plans are active for the user. </p>
  
  <p>How do I get only the active plans for a user? I am using KNEX.JS as my ORM, but I am happy to use raw SQL as well for this. </p>