title: How to retrieve data with two conditions in typeorm and nestjs
body: <p>The following class is my table</p>
  <pre><code>@Entity()
  export class Comment extends BaseEntity {
  
      @PrimaryGeneratedColumn()
      id: number
  
      @Column()
      body: string
  
      @Column()
      createdAt: Date
  
      @Column()
      userId: number
  
      @Column()
      courseId: number
  
  
      @OneToMany(() =&gt; Comment, comment =&gt; comment.parent, { eager: true })
      children: Comment[];
  
  
      @Column({ nullable: true })
      parentId: number
  
      @ManyToOne(() =&gt; Comment, comment =&gt; comment.children)
      @JoinColumn({ name: 'parentId' })
      parent: Comment
  
      @Column()
      status: CommentStatus
  }
  </code></pre>
  <p>I want to retrieve items with <code>parentId</code> equals to null and <code>coureseId</code> equals to <strong>45</strong>
  but It does not work, Where I'm wrong?</p>
  <pre><code>public async getCommentsByCourseId(courseId: number): Promise&lt;Comment[]&gt; {
      const query = this.createQueryBuilder('comment')
          .innerJoinAndSelect('comment.children', 'parent')
          .where(&quot;comment.parentId IS NULL&quot;)
          .andWhere(&quot;comment.courseId = :courseId&quot;, { courseId: 45 }) // this line does not work 
  
  
      const comments = await query.getMany()
  
      return comments
  }
  </code></pre>