<div dir="ltr"><div dir="ltr">Bernd, "qgis-user", list<br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Oct 15, 2020 at 9:47 AM <<a href="mailto:qgis-user@stripfamily.net">qgis-user@stripfamily.net</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
  
    
  
  <div>
    <div>While waiting for a more authoritative
      answer from Chris, I'd suggest trying <br>
          !='xyz' OR is NULL<br></div></div></blockquote><div><br></div><div>"authoritative" wow - I've been called a lot of things in my life but that's a first!  Thanks!</div><div><br></div><div>I like your solution.  Bernd more comments below:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div><div>
      <br>
      On 10/15/2020 10:12 AM, Bernd Vogelgesang wrote:<br>
    </div>
    <blockquote type="cite">Hi Chris,
      <br>
      <br>
      I'm a bit confused: I just stated, that I use a filter !='xyz',
      but not
      <br>
      only these rows are ommited, but also those with NULL values.
      <br>
      I do not try to filter for NULL, I just want the query to NOT
      filter
      <br>
      them out.
      <br>
      <br>
      So what I can do to keep the NULLs and just get rid of the xyz?
      </blockquote></div></blockquote><div><br></div><div></div><div>Let's look at a record where fieldname is NULL.  Then neither</div><div><br></div><div>fieldname = 'xyz'</div><div><br></div><div>nor</div><div><br></div><div>fieldname != 'xyz'</div><div><br></div><div>are true.  That's because NULL is neither equal to nor not equal to 'xyz'.</div><div><br></div><div>I find the easiest way to wrap my head around this is to think of NULL as meaning "I don't know what the value is".  If you use that definition, you can't say whether a field whose value is unknown is equal to some specific value or not equal to it.  Nor can you say that two fields, both with unknown values, are equal to one another.<br></div><div><br> </div><div>As far as I know, most programming languages like Python, Java, C, etc expect us to compare a value with null, nil, None etc using regular boolean operators.  SQL isn't like that; it provides specifically IS and IS NOT operators for checking for NULL.</div><div><br></div><div>Here are a couple of references that might help:</div><div><br></div><div><a href="https://en.wikipedia.org/wiki/Null_(SQL)">https://en.wikipedia.org/wiki/Null_(SQL)</a></div><div><a href="https://www.w3schools.com/sql/sql_null_values.asp">https://www.w3schools.com/sql/sql_null_values.asp</a></div><div><br></div><div><br></div></div><br clear="all"><br>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr">Chris Hermansen · clhermansen "at" gmail "dot" com<br><br>C'est ma façon de parler.</div></div></div>