NULL is the logical lack of a value, and is not the same as some other value EVERY SINGLE TIME. NULL is not equal to 1, NULL is not equal to 'one', NULL is also not equal to NULL. It's like NaN, except not-a-value. When you join using equality (or comparison) on a column which can have NULL values, those rows are simply not considered from the get-go. When you need to deal with NULL, remember that NULL IS NULL, and all else IS NOT NULL.
-scott On Thu, Oct 22, 2009 at 3:04 PM, Kristoffer Danielsson <kristoffer.daniels...@live.se> wrote: > > Is this the right behavior? > > > > CREATE TABLE t1(x INTEGER NOT NULL, y INTEGER); > > > INSERT INTO t1(x, y) VALUES (1, 0); > INSERT INTO t1(x, y) VALUES (2, 1); > INSERT INTO t1(x, y) VALUES (3, NULL); > > > sqlite> SELECT * FROM t1 A NATURAL JOIN t1 B; > 1|0 > 2|1 > > > I sense this could be right, but anyway... why isn't the null-row added to > the result? > > > > Sure, NULL != NULL, but in this case it's the very same value in the database. > > > > Please enlighten me! > > Thanks > > _________________________________________________________________ > Hitta kärleken nu i vår! > http://dejting.se.msn.com/channel/index.aspx?trackingid=1002952 > _______________________________________________ > 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