case, new column not found

From: Martín Marqués <martin(at)bugs(dot)unl(dot)edu(dot)ar>
To: pgsql sql Mailing List <pgsql-sql(at)postgresql(dot)org>
Subject: case, new column not found
Date: 2001-06-21 17:02:21
Message-ID: 01062120022108.16528@bugs
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

I'm trying somethings here and I get strange errors:

select *,(
(CASE WHEN titulo LIKE '%Matematica%' THEN 1 ELSE 0 END) +
(CASE WHEN descripcion LIKE '%Matematica%' THEN 1 ELSE 0 END) +
(CASE WHEN incumbencia LIKE '%Matematica%' THEN 1 ELSE 0 END) )
AS encontrados
FROM admin_view
WHERE admin_view.nivel=1 AND encontrados > 0;

ERROR: Attribute 'encontrados' not found

Why is it? encontrados should be an attribute of type INT with the count of
the rows found.

Any ideas?

Saludos... :-)

--
Cualquiera administra un NT.
Ese es el problema, que cualquiera administre.
-----------------------------------------------------------------
Martin Marques | mmarques(at)unl(dot)edu(dot)ar
Programador, Administrador | Centro de Telematica
Universidad Nacional
del Litoral
-----------------------------------------------------------------

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message James Orr 2001-06-21 17:30:39 Changing PL/pgSQL triggers
Previous Message Josh Berkus 2001-06-21 16:46:36 Re: Correct syntex for implicit curor in for loops