[Qgis-user] Select by Expression: exclusive (not inclusive)

Thayer Young thayeray at yahoo.com
Wed Jul 7 07:22:57 PDT 2021


 As Marco has explained, QGIS expressions are based on SQL which means that if you use a null containing field in a statement the nulls will be excluded from the query results unless you specifically state that they should be included. So you need to say:
"tag_service" IS NULL or "tag_service" NOT IN ('alley', 'drive-through', 'driveway', 'laneway','parking_aisle', 'parking')
-Thayer 
From: Andrew Hughes <ahhughes at gmail.com>
To: Qgis-user at lists.osgeo.org
Subject: [Qgis-user] Select by Expression: exclusive (not inclusive)
Message-ID:
    <CAMvYC1Xs=YaXj6Os5vfnnNAV_v60TJCQBauT-YgDnuToc6koMw at mail.gmail.com>
Content-Type: text/plain; charset="utf-8"

Hi All,

I can't for the life of me figure out why I can't "Select all features that
are *NOT* an alley, drive-through, driveway.... "

I am trying to use "Select by Expression".

The attribute I am trying to filter with is called "tag_service" and has 77
distinct values, including NULL.

*Q: Why does this expression select nothing?*

*"tag_service" NOT IN ('alley', 'drive-through', 'driveway', 'laneway',
'parking_aisle', 'parking')*


Supplementary, the following does select records (but I want the above
expression to work):

*"tag_service" IS NULL or "tag_service" = "service"*


Help would be much appreciated,

Thank you
Andrew

  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20210707/55652655/attachment-0001.html>


More information about the Qgis-user mailing list