I would like to query several databases that all have the same structure. Ideally, I would like to combine all databases into one that I could query as if we had only one only, for specific queries that I do from time to time. However, I haven't found anything like this in the documentation.
As far as I know I only can use attach
and join
the tables but it can get difficult to manage when using more than 3-4 tables. Here's what I have tried so far:
ATTACH DATABASE 'db1.db' AS db1;
ATTACH DATABASE 'db2.db' AS db2;
select * from db1.id as a join db2.id as b where a.status='on' AND a.status=b.status;
However, if I try to get column 'name' only for both tables I haven't been able to make it work:
select name from db1.id as a join db2.id as b where a.status='on' AND a.status=b.status;