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

189
Views
¿Cómo se puede usar el resultado de multiplicar dos columnas al filtrar? Postgres, Sequilizar

Ayuda a resolver el problema. La tabla contiene los campos precio y cantidad. Uno de los parámetros de filtrado en la solicitud es el costo. Cómo escribir correctamente y bellamente el filtrado por el parámetro de costo usando Sequilize:

 const DESC = query.desc ? 'DESC' : 'ASC'; const where = { ...(query.square_from && { square_feet: { [Op.gte]: query.square_from, }, }), ...(query.square_to && { square_feet: { [Op.lte]: query.square_to, }, }), //?????????????????????????????????????????????????????????? ...(query.total_price_from && Sequelize.where(Sequelize.literal('token_price*lot_size'), { [Op.gte]: query.total_price_from, })), //????????????????????????????????????????????????????????? }; return await this.propertySchema.findAndCountAll({ where, attributes: { exclude: ['createdAt', 'updatedAt'] }, order: [[query.orderby, DESC]], limit: PROPERTIES_BY_PAGE, offset: +(query.page - 1) * PROPERTIES_BY_PAGE, distinct: true, include: [ { model: Files, attributes: { exclude: ['createdAt', 'updatedAt'] }, through: { attributes: ['is_main'], }, }, ], }); } }
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!