"cstrader" <[EMAIL PROTECTED]> wrote
in message news:[EMAIL PROTECTED]
> Is there a way to SELECT UNION all of the tables in a database --
> that is to create a big table with rows from each of the individual
> tables?

I don't see how this is supposed to work, in general. For one thing, 
tables might have different number of columns.

> I understand I can do multiple selects, but the command gets
> very long if there are a lot of tables.

No, there is no magic bullet. If you want a union of 100 tables, you 
need to write 100 selects joined by UNION ALL.

I suspect you can solve your problem by changing your database design. 
When I see people want to do something like this, it's usually because 
they have many identical tables - e.g. each representing sales data for 
one month (with a new table created each month). The SQL way is to have 
a single table instead, with an extra column representing the month each 
record is for.

Igor Tandetnik 



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

Reply via email to