From: | Javier Estévez CIFA Córdoba <javier(dot)estevez(dot)ext(at)juntadeandalucia(dot)es> |
---|---|
To: | "Jaime Casanova" <systemguards(at)gmail(dot)com> |
Cc: | <pgsql-es-ayuda(at)postgresql(dot)org> |
Subject: | Re: COUNT |
Date: | 2006-02-27 10:47:39 |
Message-ID: | 01b801c63b8b$3b3a0970$5423410a@cfco04.cap.juntaandalucia.es |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-es-ayuda |
Lo he probado y no me funciona: mi campo es un count(*) y al hacer
sum(count(*)) me da error.
De todas formas si count(*) devuelve valores mayor o igual que cero...
me podría valer, pero creo que no es así, cuando es 0 no devuelve nada.
----- Original Message -----
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>
Sent: Monday, February 27, 2006 9:35 AM
Subject: Re: [pgsql-es-ayuda] COUNT
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
---------------------------(fin del mensaje)---------------------------
TIP 3: si publicas/lees desde Usenet, por favor envía "subscribe-nomail"
a majordomo(at)postgresql(dot)org para que tus mensajes puedan llegar
a los suscriptores de la lista
From | Date | Subject | |
---|---|---|---|
Next Message | Lic. Martin Marques | 2006-02-27 11:35:04 | Re: COUNT |
Previous Message | Pablo Braulio | 2006-02-27 10:04:42 | Re: COUNT |