[Qgis-developer] shapefiles: [field]= 'NULL' selects records with [field]= 0

Martin Dobias wonder.sk at gmail.com
Mon Oct 24 11:46:44 EDT 2011


On Mon, Oct 24, 2011 at 12:34 PM, Giovanni Manghi
<giovanni.manghi at gmail.com> wrote:
> Hi all,
>
> in a shapefile is I try to select all the records with a NULL value
>
> [field]= 'NULL'
>
> QGIS select instead the ones with value = 0.
>
> Is this expected?

Giovanni,

the NULL value is a special one - in your example above you are
actually searching for string 'NULL'. The correct expression would be:
myfield IS NULL

btw. In current development version (i.e. post 1.7) there is improved
support for NULL values and generally three-value logic
(true/false/unknown) as used in SQL. So some expressions that involve
null values may give different outcomes.

Regards
Martin


More information about the Qgis-developer mailing list