[Qgis-user] Problem filtering table on columns with NULL values

Nicolas Cadieux njacadieux.gitlab at gmail.com
Thu Oct 15 09:58:37 PDT 2020


Try

"field" IS NOT NULL OR "field" != 'xyz'

Nicolas

On 2020-10-15 12:12 p.m., Bernd Vogelgesang wrote:
> Hi Chris,
>
> I'm a bit confused: I just stated, that I use a filter !='xyz', but not
> only these rows are ommited, but also those with NULL values.
> I do not try to filter for NULL, I just want the query to NOT filter
> them out.
>
> So what I can do to keep the NULLs and just get rid of the xyz?
>
> Cheers,
>
> Bernd
>
> On 15.10.20 16:56, chris hermansen wrote:
>> Bernd and list,
>>
>> On Thu, Oct 15, 2020 at 5:18 AM Bernd Vogelgesang 
>> <bernd.vogelgesang at gmx.de>
>> wrote:
>>
>>> Hi,
>>>
>>> just hit a problem when working with a table from an .ods file.
>>>
>>> To work with the data, I have to exclude some values from a field, 
>>> where
>>> some entries also have NULL values.
>>>
>>> When I now filter on the value I do not need ("field" != 'xyz'), also
>>> the rows with  NULL values in that field are filtered out, which is not
>>> what I want.
>>>
>> In databases that support NULL values it's customary to use "IS NULL"
>> rather than "= NULL".   The rationale is that a boolean expression
>> involving NULL values can't be true nor false since the meaning of 
>> NULL is
>> "unknown".
>>
>>
>>> As I do not want to "invent" data for those rows just to make it 
>>> work, I
>>> wonder if this is a bug or if there is a workaround for this problem.
>>>
>> I just tried this with the QGIS select calculator (IS NULL) and it 
>> seems to
>> work fine there.
>>
>>
>>
>>
> _______________________________________________
> Qgis-user mailing list
> Qgis-user at lists.osgeo.org
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user


More information about the Qgis-user mailing list