Hi Bob, 
A correction to my previous statement, SQL does care about capitalization in 
string literals, so 'alley' <> 'ALLEY'. But you could write:   "tag_service" is 
null or "tag_service" not in ('alley', 'drive-through', 'driveway', 
'laneway','parking_aisle', 'parking') AS WELL AS:   "tag_service" IS NULL OR 
"tag_service" NOT IN ('alley', 'drive-through', 'driveway', 
'laneway','parking_aisle', 'parking')
You could also, remove the double quotes from around the field name, and 
capitalize the field name and have it work:  TAG_SERVICE is NULL or TAG_SERVICE 
not IN ('alley', 'drive-through', 'driveway', 'laneway','parking_aisle', 
'parking')
The double quotes are not necessary unless you have a space or other 
non-alphanumeric character in the field name.
Hope this helps.
-Thayer


    On Wednesday, July 7, 2021, 10:49:55 AM EDT, Thayer Young 
<[email protected]> wrote:  
 
  Hi Bob, 
No, SQL does not care about capitalization, it is used for humans to read each 
others code. So I neglected to capitalize the OR, making it harder for you to 
read, but the interpreter should do just fine.
Python on the other hand cares very much about capitalization and white space. 
SQL does not care about white space either, so you can put extra spaces, tabs 
and carriage returns in your code.
-Thayer


    On Wednesday, July 7, 2021, 10:26:50 AM EDT, Basques, Bob (CI-StPaul) 
<[email protected]> wrote:  
 
 
Not a Capitalization thing?
 
  
 
Bobb
 
  
 
  
 
From: Qgis-user <[email protected]> On Behalf Of Thayer Young
Sent: Wednesday, July 7, 2021 9:23 AM
To: [email protected]
Subject: [Qgis-user] Select by Expression: exclusive (not inclusive)
 
  
 
| 
Think Before You Click:This email originated outsideour organization.
  |


  
 
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 <[email protected]>
 
To:[email protected]
 
Subject: [Qgis-user] Select by Expression: exclusive (not inclusive)
 
Message-ID:
 
    <CAMvYC1Xs=yaxj6os5vfnnnav_v60tjcqbaut-ygdnutoc6k...@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
 
  
     
_______________________________________________
Qgis-user mailing list
[email protected]
List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user

Reply via email to