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

348
Views
fusionarse con la función de filtro en postgresql

Estoy ejecutando esta consulta:

 SELECT SUM(PRICE) FILTER (my filter's parameters)

y cuando no hay registro devuelve <null>

luego probé:

 SELECT COALESCE(SUM(PRICE),0) FILTER (my filter's parameters)

Pero luego aparece un error FILTER not valid for coalesce function

los parámetros de mi filtro son una ventana de tiempo, así:

 FILTER(WHERE date(order_date) >= (cast(current_date as date) - interval '1' day)) as day1

¿Cómo puedo reemplazar <null> by 0 cuando no hay registro?

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Debería intentar envolver toda la expresión FILTER en COALESCE , por ejemplo

 SELECT COALESCE(SUM(PRICE) FILTER (my filter's parameters), 0) AS sum_price
over 4 years ago · Santiago Trujillo Report
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!