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: | "Alvaro Herrera" <alvherre(at)commandprompt(dot)com>, <pgsql-es-ayuda(at)postgresql(dot)org> |
Subject: | Re: COUNT |
Date: | 2006-03-06 10:49:54 |
Message-ID: | 012e01c6410b$b89f4850$5423410a@cfco04.cap.juntaandalucia.es |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-es-ayuda |
GRACIAS...
----- 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: "Alvaro Herrera" <alvherre(at)commandprompt(dot)com>;
<pgsql-es-ayuda(at)postgresql(dot)org>
Sent: Friday, March 03, 2006 5:40 AM
Subject: Re: COUNT
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
From | Date | Subject | |
---|---|---|---|
Next Message | Mario Gonzalez | 2006-03-06 12:41:18 | Re: Duda sobre funciones |
Previous Message | hector lozano | 2006-03-06 03:27:19 | Duda sobre funciones |