Re: COUNT

From: "Jaime Casanova" <systemguards(at)gmail(dot)com>
To: Javier Estévez CIFA Córdoba <javier(dot)estevez(dot)ext(at)juntadeandalucia(dot)es>
Cc: pgsql-es-ayuda(at)postgresql(dot)org
Subject: Re: COUNT
Date: 2006-02-27 08:35:00
Message-ID: c2d9e70e0602270035u37f5a574j5f7b981e23c3fca0@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-es-ayuda

On 2/27/06, Javier Estévez CIFA Córdoba
<javier(dot)estevez(dot)ext(at)juntadeandalucia(dot)es> wrote:
> Es posible que al realizar un count(*) me devuelva el valor 0 cuando
> corresponda?
>
> Cómo puedo hacerlo?
>
> Gracias. Javier Estévez
>

estas pensando en sum...
count siempre regresa un valor numerico >= 0

respecto a tu pregunta... seria

select coalesce(sum(campo), 0) from tabla

--
Atentamente,
Jaime Casanova

"What they (MySQL) lose in usability, they gain back in benchmarks, and that's
all that matters: getting the wrong answer really fast."
Randal L. Schwartz

In response to

  • COUNT at 2006-02-27 08:11:29 from Javier Estévez CIFA Córdoba

Responses

  • Re: COUNT at 2006-02-27 09:35:05 from Moko Verdoso
  • Re: COUNT at 2006-02-27 10:47:39 from Javier Estévez CIFA Córdoba

Browse pgsql-es-ayuda by date

  From Date Subject
Next Message Jaime Casanova 2006-02-27 08:42:24 Re: migracion de datos desde oracle a postgrSql
Previous Message Javier Estévez CIFA Córdoba 2006-02-27 08:11:29 COUNT