CASE WHEN FIELD1='A' AND FIELD2<>'B' THEN X ELSE Y END ; There are several variants of SQL, but one page with good examples is this:
http://www.postgresql.org/docs/9.0/static/functions-conditional.html ----- Mail original ----- De: "Filipe Silva Dias" <[email protected]> À: "Jürgen E." <[email protected]>, [email protected] Envoyé: Mercredi 2 Mai 2012 16:29:53 Objet: Re: [Qgis-user] SQL statement No, it doesnt work: Expression is invalid "Syntax error unexpected COLUMN_REF, expecting WHEN" Thks Filipe On Wed, May 2, 2012 at 3:19 PM, Jürgen E. < [email protected] > wrote: On Wed, 02. May 2012 at 14:14:12 +0100, Filipe Silva Dias wrote: > Dear all, > > I'm trying to fill a column using an SQL statement, but Ive been > unsuccessful so far. In LibreOffice I would use the following syntax: > > =IF(AND(FIELD1="A";FIELD2<>"B");X;Y) I suppose something like: CASE FIELD1='A' AND FIELD2<>'B' THEN X ELSE Y END Jürgen -- Jürgen E. Fischer norBIT GmbH Tel. +49-4931-918175-31 Dipl.-Inf. (FH) Rheinstraße 13 Fax. +49-4931-918175-50 Software Engineer D-26506 Norden http://www.norbit.de committ(ed|ing) to Quantum GIS IRC: jef on FreeNode -- norBIT Gesellschaft fuer Unternehmensberatung und Informationssysteme mbH Rheinstrasse 13, 26506 Norden GF: Jelto Buurman, HR: Amtsgericht Emden, HRB 5502 _______________________________________________ Qgis-user mailing list [email protected] http://lists.osgeo.org/mailman/listinfo/qgis-user _______________________________________________ Qgis-user mailing list [email protected] http://lists.osgeo.org/mailman/listinfo/qgis-user _______________________________________________ Qgis-user mailing list [email protected] http://lists.osgeo.org/mailman/listinfo/qgis-user
