I have a few SQLite databases and I'm using DB Visualizer Free to view the tables. I would like to create selects statements with joins between the sqlite databases. From the SQLite documentation I can see that the DB can be linked using the ATTACH http://www.sqlite.org/lang_attach.html statement. I can't for the life of me get this to work.
In DbVisualizer I have created two connections A (A.db) and B (B.db). A has a table called TABLE_A and B has a TABLE_B. From other posts I have tried to do the following:
ATTACH DATABASE 'A' AS 'DB1';
SELECT * FROM DB1.TABLE_A;
I'm getting the following error from DB Visualizer:
[SELECT - 0 row(s), 0.000 secs] [SQLITE_ERROR] SQL error or missing database (no such table: DB1)
I have tried to take the single quote off both A and DB1 and the combination of the two, but nothing seems to work. I have also tried to change A to A.db and that doesn't work.
I don't think the ATTACH command is linking correctly.
ATTACH will happily create a new database if the file does not yet exist.
The file name 'A'
specifies a file named "A" in the current directory.
You should specify the full path and the full file name:
ATTACH 'C:\some\where\A.db' AS db1;