So can someone give me a working example of two database ATTACHed and a
simple select using columns from a table in each database

On 13 August 2015 at 07:13, Chris Parsonson <z2668856 at gmail.com> wrote:

> Now we get down to the first real problem that of the ATTACH. I have never
> been able to get that to work. If I could have got the ATTACH to work I
> probably would never have had to ask the synchronisation question. Although
> I have never had to do it before in SQLite, I have worked a lot with SQL
> Server doing synchronisation there
>
> On 13 August 2015 at 07:08, Simon Slavin <slavins at bigfraud.org> wrote:
>
>>
>> On 13 Aug 2015, at 5:55am, Chris Parsonson <z2668856 at gmail.com> wrote:
>>
>> > The tables are very simple. They have a primary key, but no relationship
>> > between tables in the sense that you mean. Synchronisation will be add
>> new
>> > rows, and update some rows, no deletions
>>
>> To access two different databases with one database connection, use the
>> ATTACH command.
>>
>> Method 1
>> --------
>>
>> To find rows which are in one table but not in the other, use EXCEPT
>>
>> SELECT primaryKeyColumn FROM databasea.myTable EXCEPT SELECT
>> primaryKeyColumn FROM myTable
>>
>> In cases where a row has been updated with a new value in one column, how
>> do you propose to decide which value is the 'right' one to put in both
>> databases ?
>>
>> Method 2
>> --------
>>
>> Ignore Method 1.  In each copy of your database keep a log of all INSERT
>> and UPDATE commands executed since the last 'synchronize':
>>
>> CREATE TABLE commandsSinceLastSynch (theCommand TEXT)
>>
>> To synchronise the two copies, play back the log for copy A to copy B and
>> the log for copy B to copy A.
>>
>> Simon.
>> _______________________________________________
>> sqlite-users mailing list
>> sqlite-users at mailinglists.sqlite.org
>> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>>
>
>
>
> --
> Chris Parsonson
> 083 777 9261
>



-- 
Chris Parsonson
083 777 9261

Reply via email to