On 11/1/19, Jose Isaias Cabrera <jic...@outlook.com> wrote:
> sqlite> select count(a.n),count(b.n),count(c.n) FROM t0 AS a LEFT JOIN t1 AS
> b LEFT JOIN t2 AS c;
> 3375|3375|3375
>
> Huh?  I expected the result:
>
> 15|15|15

You did a three-way join on tables with 15 rows each.  15x15x15 is 3375.

A LEFT JOIN without an ON clause is just a JOIN.  Or, to view it
another way, it is the same as having "ON true" on each LEFT JOIN.
LEFT JOIN only differs from JOIN when the ON clause evaluates to false
or NULL, in which case the right table of the LEFT JOIN pretends to be
a table of a single row of all NULL values.

-- 
D. Richard Hipp
d...@sqlite.org
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to