title: How to select only single/multiple fields from joined entity in Typeorm
body: <p>accord to TypeOrm doc: <a href="https://github.com/typeorm/typeorm/blob/master/docs/select-query-builder.md#joining-relations" rel="noreferrer">https://github.com/typeorm/typeorm/blob/master/docs/select-query-builder.md#joining-relations</a></p>
  <p>We can query the joined entity's field that will populate all its field into the response. I am not sure how to restrict only to few selected fields(single/multiple), I tried adding 'select([])' but it is not working in the generated SQL query I can see it is querying all the fields.</p>
  <p>code:</p>
  <pre><code>import {Entity, PrimaryGeneratedColumn, Column, OneToMany} from &quot;typeorm&quot;;
  import {Photo} from &quot;./Photo&quot;;
  
  @Entity()
  export class User {
  
      @PrimaryGeneratedColumn()
      id: number;
  
      @Column()
      name: string;
  
      @OneToMany(type =&gt; Photo, photo =&gt; photo.user)
      photos: Photo[];
  }
  import {Entity, PrimaryGeneratedColumn, Column, ManyToOne} from &quot;typeorm&quot;;
  import {User} from &quot;./User&quot;;
  
  @Entity()
  export class Photo {
  
      @PrimaryGeneratedColumn()
      id: number;
  
      @Column()
      url: string;
  
      @Column()
      alt: string;
  
      @ManyToOne(type =&gt; User, user =&gt; user.photos)
      user: User;
  }
  </code></pre>
  <p>and on the code:</p>
  <pre><code>const user = await createQueryBuilder(&quot;user&quot;)
      .leftJoinAndSelect(&quot;user.photos&quot;, &quot;photo&quot;)
      .where(&quot;user.name = :name&quot;, { name: &quot;Timber&quot; })
      .getOne();
  </code></pre>
  <p>The above code gives the output as  -</p>
  <pre><code>{
      id: 1,
      name: &quot;Timber&quot;,
      photos: [{
          id: 1,
          url: &quot;me-with-chakram.jpg&quot;,
          alt: &quot;Me With Chakram&quot;
      }, {
          id: 2,
          url: &quot;me-with-trees.jpg&quot;,
          alt: &quot;Me With Trees&quot;
      }]
  }
  </code></pre>
  <p>Is there a way I can query only 'url' and 'alt' so the output will look something like this -</p>
  <pre><code>{
      id: 1,
      name: &quot;Timber&quot;,
      photos: [{
          url: &quot;me-with-chakram.jpg&quot;,
          alt: &quot;Me With Chakram&quot;
      }, {
          url: &quot;me-with-trees.jpg&quot;,
          alt: &quot;Me With Trees&quot;
      }]
  }
  </code></pre>