Skip site navigation (1) Skip section navigation (2)

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 (view raw or flat)
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

pgsql-es-ayuda by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group