>> select typeof(max(id)) from categories -- returns 'null' >> select case max(id) when null then 1 end as NextID from categories > > Matching with "null" does not work the same as matching with other values. > "null" means "I don't know." so every value matches with it.
Just the opposite - every value doesn't match with it, even null. :) Kai, You should use query as the following: select case when max(id) is null then 1 end as NextID from categories Pavel On Fri, Jan 27, 2012 at 2:44 PM, Simon Slavin <slav...@bigfraud.org> wrote: > > On 27 Jan 2012, at 7:43pm, K Peters wrote: > >> Why would the second statement still return null if the first statements >> returns 'null'? >> >> >> select typeof(max(id)) from categories -- returns 'null' >> select case max(id) when null then 1 end as NextID from categories > > Matching with "null" does not work the same as matching with other values. > "null" means "I don't know." so every value matches with it. > > Simon. > _______________________________________________ > sqlite-users mailing list > sqlite-users@sqlite.org > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users