2

I have only basic knowledge of using SQL code in QGIS. I am trying to use Query Builder to hide some specific line features. I have tried using =! and the id field reference for the particular features I want to hide but this results in zero features being selected. The column is text. I have tried creating a new column as text and identifying the fields I want as 'yes'and then writing a query identifying those fields not yes. I then did the same but this time as a integer but this doesn't work. Can anyone help. I'm sure its a simple task to do. Interestingly the text fields are all blank rather than null. How do you select a field that is empty

asked Dec 1, 2017 at 13:19
2
  • 1
    Do you use "Filter" to query your expression? Or did you try your expression from properties--> symbology...? Commented Dec 1, 2017 at 13:36
  • Hi Dirk I used query builder on the general tab in properties Commented Dec 3, 2017 at 20:55

1 Answer 1

3

The 'not equal to' operator in SQL is '<>' so you need to use:

OBJECTID <> 1

To select null fields you use:

IS NULL

To select text fields that are empty but not null try selecting an empty string '' or a string with a space ' ':

TextField = ''
TextField = ' '
answered Dec 1, 2017 at 14:28
1
  • Thanks for your suggestions. Is NULL works. What threw me was there is no operator option to use IS so my lack of programming knowledge didn't allow me to 'get creative'. Thanks again Commented Dec 8, 2017 at 10:35

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.