On 17 Nov 2014, at 10:55am, Paul Sanderson <sandersonforens...@gmail.com> wrote:

> Is it possible to get a row count for each of the tables in a database
> using a SQL query.
> 
> i.e.
> 
> is there a way I could use each row in sqlite_master and use
> table_name to somehow do a select count(*) from
> sqlite.master.table_name

No, but you can use UNION to get something like it:

SELECT 'table1',count(*) FROM table1
UNION
SELECT 'table2',count(*) FROM table2

should do something like what you want.  As far as I know, there's no way 
within SQL to use a table name as a variable.  I suspect that this was done 
deliberately to enforce correct schema.

Simon.
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to