Donald, Thanks for your reply, its all a bit new to me, so i'm still trying to get my head round it and hopefully be able to explain myself better.
I'm actually creating the unique ids, it is just a number. I now think my understanding of an attached database is wrong, my first thoughts were that a single SELECT command would query both databases, but now i believe i would have to use the following syntax to do a query on both databases: SELECT id, name FROM database1.main, database2.main WHERE name == %me% ORDER BY name Which would produce alphabetically sorted results from both attached tables? But because both the databases will have been created separately, they could have overlapping ids, which i need to avoid. To avoid overlapping ids i could manually get all the ids from database1 and (for arguments sake) add a '1' to the end and all the ids from database2 and add a '2' to the end. If the client then requested further information on id 6731, i would know it was from database 1, strip that digit out and so get further information from id 673 database1. Doing it this way however means i have to alphabetically sort the results from the two tables, after the two queries. So i guess i was just wondering if this was all possible in a single query, or sqlite gave some indication of where the results were coming from so i could tag them for id mangling. I hope i've managed to explain myself better and not made it even worse! Thanks Andrew -----Original Message----- From: Griggs, Donald [mailto:[EMAIL PROTECTED] Sent: 04 August 2005 13:56 To: '[email protected]' Subject: RE: [sqlite] ATTACH, query and differentiate Hi Andrew, Perhaps I shouldn't be replying since I don't think I'm understanding your question fully. When you wrote: "with each entry having a unique id" did you mean that you are creating a unique identifier, or instead that you are making use of the ROWID within sqlite? Regarding: "it is my understanding that a SELECT command will treat both databases as one and so return potentially overlapping ids" Can you elaborate on that understanding? Sqlite 3 can create transactions that are atomic across multiple databases (if the main database is not an in-memory one), but I'm not sure what "treat as ... one" would otherwise mean. Even for a single database, ROWID values are unique ONLY within a particular table. Therefore (to my understanding) if you call out a particular database, a particular table, and a particular ROWID, then you've uniquely identified a row. Dan Kennedy just referred to the ATTACH documentation which may be helpful: http://www.sqlite.org/lang_attach.html Donald Griggs Opinions are not necessarily those of Misys Healthcare Systems nor its board of directors. -----Original Message----- From: Andrew Gatt [mailto:[EMAIL PROTECTED] Sent: Thursday, August 04, 2005 6:56 AM To: [email protected] Subject: [sqlite] ATTACH, query and differentiate

