[Qgis-user] SQL statement

mayeul.kauffmann at free.fr mayeul.kauffmann at free.fr
Wed May 2 07:35:04 PDT 2012


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" <filipesdias at gmail.com>
À: "Jürgen E." <jef at norbit.de>, qgis-user at lists.osgeo.org
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. < jef at norbit.de > 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 
Qgis-user at lists.osgeo.org 
http://lists.osgeo.org/mailman/listinfo/qgis-user 


_______________________________________________
Qgis-user mailing list
Qgis-user at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-user



More information about the Qgis-user mailing list