title: How can I select specific columns from a joined table in Knex.js?
body: <p>I have worked about 20 years with SQL databases and seem to have trouble understanding Knex way to map queries.  Can someone help me get the correct code?</p>
  
  <p>I have this SQL query that I want to use in my nodejs application:</p>
  
  <pre><code>SELECT p.id, p.project_number, p.project_name, p.start_date, p.end_date,
     o.name, o.email_addr,
     c.company, c.email_addr AS company_email, c.first_name, c.last_name
  FROM projects p
  INNER JOIN owners o ON o.id = p.owner_id
  INNER JOIN clients c ON c.id = p.client_id
  </code></pre>
  
  <p>KnexJS (0.7.5) documentation shows example that would look like this for my query:</p>
  
  <pre><code>knex.from('projects').innerJoin('owners', 'owners.id', 'projects.owner_id')
    .innerJoin('clients', 'clients.id', 'projects.client_id');
  </code></pre>
  
  <p>There are couple of things I cannot find in the documentation:</p>
  
  <p>1) how do I select which columns I want to include? Projects, Clients and Owners each have 20 to 50 columns and I am not interested in all of them.  Selecting columns from the main table is clear (using <strong>select()</strong> or <strong>column()</strong> ) but how to select columns from the joined tables?</p>
  
  <p>2) Some columns have identical names.  How can I avoid name conflicts (i.e. add some prefix to columns from other tables)?  I looked at the way Knex can generate column aliases (... AS ...) and I am not sure it is a viable option for more complex queries. (Even for relatively simple queries like the one above)</p>