| From: | Alvaro Herrera <alvherre(at)commandprompt(dot)com> |
|---|---|
| To: | Iván de Gyves López [[POD]] <biz004wm(at)gmail(dot)com> |
| Cc: | pgsql-es-ayuda(at)postgresql(dot)org |
| Subject: | Re: Consulta con Condicionales |
| Date: | 2008-06-15 19:35:56 |
| Message-ID: | 20080615193556.GK8519@alvh.no-ip.org |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-es-ayuda |
"Iván de Gyves López [[POD]]" escribió:
> -------------------------------------------------------------------------------------------------------------------------
> xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
> SELECT COUNT( * ) AS cte FROM rde1 WHERE id = x AND group_id = y, CASE
> WHEN cte > 0 THEN true ELSE false END AS result;
Usa un subselect
select cte, case when cte > 0 then true else false end as result from
(select count(*) as cte from rde1 where id = x and group_id = y) as foo
--
Alvaro Herrera http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Alvaro Herrera | 2008-06-15 19:38:11 | Re: Rendimiento sin COMMIT |
| Previous Message | Juan Carlos Barranco de Paz | 2008-06-15 19:14:37 | RE: Rendimiento sin COMMIT |