On Sun, Mar 14, 2010 at 05:01:18PM -0700, David Lyon scratched on the wall: > if I had a database called db1 with table tbl1 with field id and a > second db called db2 and a table called tbl2 with field id, whats the > correct syntax to query across the 2 databases eg: > > "select * db1..tbl1 a , db2..tbl2 b where a.id=b.id"
The FROM clause expects a table, so it only takes one dot to move up a level from table to database. SELECT * FROM db1.tbl1 a, db2.tbl2 b WHERE a.id = b.id This should also work if both databases have tables with the same name: SELECT * FROM db1.tbl a, db2.tbl b WHERE a.id = b.id However, if the table names are unique, you don't actually need to qualify them: SELECT * FROM tbl1, tbl2 WHERE tbl1.id = tbl2.id -j -- Jay A. Kreibich < J A Y @ K R E I B I.C H > "Our opponent is an alien starship packed with atomic bombs. We have a protractor." "I'll go home and see if I can scrounge up a ruler and a piece of string." --from Anathem by Neal Stephenson _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users