开发者

How to make a join from tables of multiple databases?

I have a read开发者_运维技巧-only table in a SQLite DB file and a dynamically created table in another SQLite DB. I would like to make is a join of these two. The problem I see is that a query gets executed on one SQLiteDatabase object, so any columns from other databases are not known(e.g. FROM entries, DB2.entries). What I would like to have is something like this:

SELECT e1.id
FROM DB1.entries AS e1, DB2.entries AS e2
WHERE e1.id = e2.id

Is this even possible?


According to sqlite documentation, it should be possible by attaching the second database to the same connection:

ATTACH /file/database2.db AS DB2;

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜