X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id ABAB256520 for ; Mon, 21 Mar 2005 14:19:16 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 03133-05 for ; Mon, 21 Mar 2005 14:19:14 +0000 (GMT) Received: from bugs.unl.edu.ar (bugs.unl.edu.ar [168.96.132.208]) by svr1.postgresql.org (Postfix) with ESMTP id 0782E56503 for ; Mon, 21 Mar 2005 14:19:13 +0000 (GMT) Received: from localhost (localhost [127.0.0.1]) by bugs.unl.edu.ar (Postfix) with ESMTP id 2D0C31206E for ; Mon, 21 Mar 2005 11:18:48 -0300 (ART) Received: from bugs.unl.edu.ar ([127.0.0.1]) by localhost (bugs [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 19437-05 for ; Mon, 21 Mar 2005 11:18:47 -0300 (ART) Received: from localhost (localhost [127.0.0.1]) by bugs.unl.edu.ar (Postfix) with ESMTP id 73BAD1206D for ; Mon, 21 Mar 2005 11:18:47 -0300 (ART) From: =?iso-8859-1?q?Mart=EDn_Marqu=E9s?= To: pgsql-sql@postgresql.org Subject: CASE not working Date: Mon, 21 Mar 2005 11:18:38 -0300 User-Agent: KMail/1.7.1 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Message-Id: <200503211118.39223.martin@bugs.unl.edu.ar> X-Virus-Scanned: by amavisd-new-20030616-p10 (Debian) at bugs.unl.edu.ar X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.14 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200503/283 X-Sequence-Number: 20762 I have this query which has a CASE in the middle to give me special results= =2E=20 The problem is that it doesn't interpret my columns as it should. Here is the porblem: siprebi=3D> SELECT getvencimientosancion(190) AS vence, (SELECT codigo FROM= =20 sanciones WHERE persona =3D (SELECT persona FROM usuarios WHERE codigo =3D= 190)=20 ORDER BY femodif DESC LIMIT 1) AS sancion_original, CASE WHEN vence>=3Dnow= ()=20 THEN 1 ELSE 0 END AS sancionado; ERROR: no existe la columna "vence" (the translation of the error is: column "vence" does not exist). I don't know what I'm getting wrong here. =2D-=20 11:12:48 up 2 days, 15:43, 2 users, load average: 0.95, 0.54, 0.56 =2D---------------------------------------------------------------- Mart=EDn Marqu=E9s | select 'mmarques' || '@' || 'unl.edu.ar' Centro de Telematica | DBA, Programador, Administrador Universidad Nacional del Litoral =2D----------------------------------------------------------------