title: Using whereRaw clause in knex for postgres client
body: <p>The following pagination query works fine if I want to fetch all the columns from a table given the following arguments</p>
  
  <pre><code>getOrdersPagination(limit, after) {
  
      let where = '';
      if (after &gt; 0) {
          where = `id &lt; ${after}`;
      }
  
      return knex
          .select(
              'id',
              'patient_id AS patientId',
              'pharmacy_id AS pharmacyId',
              'customer_id AS customerId',
              'department_id AS departmentId',
              'user_id AS userId',
              'status',
              'info',
              'created_at AS createdAt'
          )
          .from('order')
          .whereRaw(where)
          .orderBy('id', 'desc')
          .limit(limit);
  }
  </code></pre>
  
  <p>However, if I am passing another argument (in this case <code>status</code>) to further filter out the rows returned, I am getting exactly the same output as the aforementioned query. The <code>status</code> field (integer) does not have any affect on my <code>getOrdersByStatusPagination</code> query.</p>
  
  <pre><code>getOrdersByStatusPagination(limit, after, status) {
  
      let where = '';
      if (after &gt; 0) {
          where = `id &lt; ${after} AND status = ${status}`;
      }
  
      return knex
          .select(
              'id',
              'patient_id AS patientId',
              'pharmacy_id AS pharmacyId',
              'customer_id AS customerId',
              'department_id AS departmentId',
              'user_id AS userId',
              'status',
              'info',
              'created_at AS createdAt'
          )
          .from('order')
          .whereRaw(where)
          .orderBy('id', 'desc')
          .limit(limit);
  }
  </code></pre>
  
  <p>I wonder if I am using the <code>whereRaw</code> clause correctly to include multiple where statements using <code>AND</code> operator.</p>
  
  <p><a href="http://knexjs.org/#Builder-whereRaw" rel="nofollow noreferrer">http://knexjs.org/#Builder-whereRaw</a></p>
  
  <p>I can also include a sample JSON output of the query, but I am not sure if that is of any help since it is just fetching all the data from the mentioned columns.</p>