Variable Substitution in Postgis Query

Puneet Kishor punkish at EIDESIS.ORG
Thu Feb 16 09:46:07 EST 2006


On Feb 16, 2006, at 8:45 AM, Maurizio Esposito wrote:

> Ciao Umberto
> hi list
> this is the query where substitution doesn't work:
>
> DATA "the_geom from buildings"
> FILTER "buildings.pk_id NOT IN (SELECT feat_id FROM feat_vis WHERE
> feat_vis.ruolo='%ruolo%' AND feat_vis.layer='buildings')"
>
> The table feat_vis is used as an exclusion list with the following
> attributes:
> ruolo
> layer
> feat_id
>
> and if I substitute %ruolo% with a string value, i.e. 'technician' the
> query works fine

when using %..%, you have to use LIKE. Try

SELECT feat_id
FROM feat_vis
WHERE feat_vis.ruolo LIKE '%ruolo%' AND
   feat_vis.layer = 'buildings'



--
Puneet Kishor



More information about the mapserver-users mailing list