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: "Alvaro Herrera" <alvherre(at)commandprompt(dot)com>, pgsql-es-ayuda(at)postgresql(dot)org
Subject: Re: COUNT
Date: 2006-03-03 04:40:13
Message-ID: c2d9e70e0603022040u14df3f62pd580381c1a1873e8@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-es-ayuda

On 3/2/06, Javier Estévez CIFA Córdoba
<javier(dot)estevez(dot)ext(at)juntadeandalucia(dot)es> wrote:
> Tengo 2 tablas, en una valores DIARIOS y en la OTRA media y desviación
> típica de cada MES.
>
> Tengo que chequear qué valores diarios (tabla a) están fuera de un rango
> determinado (tabla b). Quiero que para cada Provincia y Estación, me
> seleccione el número de valores fuera de ese RANGO.
>

SELECT a."IdProvincia", a."IdEstacion", count(b.*)
FROM ria_day a LEFT OUTER JOIN ria_mes_avg_std b
ON (a."IdProvincia" = b."IdProvincia" AND
a."IdEstacion" = b."IdEstacion" AND
a.mes = b.mes AND
a."TempMax" NOT BETWEEN b."TxAVGmes"-2.0*"TxSTDmes"
AND b."TxAVGmes"+2.0*"TxSTDmes")
GROUP by b."IdProvincia", b."IdEstacion"
ORDER by b."IdProvincia", b."IdEstacion"

deberia funcionar...

--
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

  • Re: COUNT at 2006-03-02 08:19:51 from Javier Estévez CIFA Córdoba

Responses

  • Re: COUNT at 2006-03-06 10:49:54 from Javier Estévez CIFA Córdoba

Browse pgsql-es-ayuda by date

  From Date Subject
Next Message Jaime Casanova 2006-03-03 05:01:34 Re: Ayudaaaa, bloqueo de filas o tablas
Previous Message Alvaro Herrera 2006-03-03 03:11:35 Re: Problemas con ODBC