Jim Morris, on Friday, November 1, 2019 12:07 PM, wrote... > > Using a sub-select should work > > select > > (select count(n) from t0) as "t0_count", > > (select count(n) from t1) as "t1_count", > > (select count(n) from t2) as "t2_count" > > ;
Thanks. Works. josé > On 11/1/2019 9:07 AM, Jose Isaias Cabrera wrote: > > Jose Isaias Cabrera, on Friday, November 1, 2019 11:51 AM, wrote... > >> > >> Richard Hipp, on Friday, November 1, 2019 11:41 AM, wrote... > >>> On 11/1/19, Jose Isaias Cabrera, on > >>>> 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. > >> Thanks, Dr. Hipp. Now I understand why the real query hung, and didn't > >> produce a > >> response. Sorry for the lack of knowledge. :-) Anyone, out there, how do > >> I get > >> the record count of three tables in one call? Thanks. > > So, I got it to work in 3 rows, > > > > select count(n) from t0 UNION ALL Select count(n) FROM t1 UNION ALL SELECT > > count(n) FROM t2; > > 15 > > 15 > > 15 > > > > But, is there a way to get it to work on one row? Sorry for the newbie > > post. Thanks. > > > > josé _______________________________________________ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users