Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

398
Views
Knex.js .count() with where clause

I have a route that returns statistics about quotes such as total estimate, total quotes and total quote where complete is true or not true.

function totalCount() {
  return db('quotes')
    .count('is_complete', {as: 'total_complete'})
    .count('is_complete')
    .sum('estimate', {as: 'estimate_total'})
    .first()

The issue I am having it getting the where clause into my knex query. If it try to set a where clause the beginning of the query, it affects the whole query.

My where clause is where is_complete = true

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!