title: How i can make this query using lucid models/query builder in adonis?
body: <p>I need to make a query that return all book_unit_questions of one Book.</p>
  
  <p>So, i have the Book.Id.</p>
  
  <p>I'm trying something like:</p>
  
  <pre><code>SELECT BO.id,
  BUQ.description
  FROM book_unit_question BUQ 
  JOIN book_unit BU
  ON(BUQ.book_unit_id = BU.book_id)
  INNER JOIN Books BO
  ON(BU.book_id = 1)
  </code></pre>
  
  <p>But this way is returning id from other books, and i was expected some the id 1:</p>
  
  <p><a href="https://i.stack.imgur.com/KqGUS.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/KqGUS.png" alt="enter image description here"></a></p>
  
  <p>My migrations files:</p>
  
  <pre><code>class BookSchema extends Schema {
    up () {
      this.create('books', (table) =&gt; {
        table.increments()
        table.string('code').notNullable().unique()
        table.string('description')
        table.string('authors')
        table.boolean('status').defaultTo(false)
        table.integer('user_id').references('id').inTable('users')
        table.timestamps()
      })
    }
  
  class BookUnitSchema extends Schema {
    up () {
      this.create('book_unit', (table) =&gt; {
        table.increments()
        table.integer('book_id').references('id').inTable('books').notNullable()
        table.integer('unit').notNullable()
        table.integer('sequence').notNullable()
        table.string('description')
        table.integer('qt_question')
        table.boolean('status').defaultTo(false)
        table.integer('user_id').references('id').inTable('users')
        table.timestamps()
        table.unique(['unit', 'sequence', 'book_id'])
      })
    }
  
  class BookUnitQuestionSchema extends Schema {
    up () {
      this.create('book_unit_question', (table) =&gt; {
        table.increments()
        table.integer('book_unit_id').references('id').inTable('book_unit')
        table.string('question_form')
        table.string('option_form')
        table.string('type_answer')
        table.string('description')
        table.string('correct_answer_description')
        table.integer('correct_answer_description_id')
        table.text('image_sound')
        table.boolean('status').defaultTo(false)
        table.integer('user_id').references('id').inTable('users')
        table.timestamps()
      })
    }
  </code></pre>