Muchas gracias.


-----Original Message----- From: Simon Slavin
Sent: Tuesday, August 22, 2017 6:32 PM
To: SQLite mailing list
Subject: Re: [sqlite] Updating 3 tables based on the ProjID



On 22 Aug 2017, at 11:08pm, jose isaias cabrera <[email protected]> wrote:

LSOpenProject has the same columns as client.LSOpenProjects. The same is true for LSOpenSubProject and LSOpenJobs. I am just trying to save time with the inner most SELECT ProjID.

I made a mistake. Your original code inserts the same rows into three different tables. I thought it inserted three different sets of rows into one table.

So it depends on how much data you have in your tables but you might do something like

CREATE TEMPORARY TABLE newRows (<whatever>);

That at the beginning of your program.  Then when you backup ...

INSERT INTO newRows SELECT * FROM LSOpenProjects
    WHERE ProjID IN
    (
      SELECT ProjID from LSOpenProjects
      WHERE
        XtraB != client.LSOpenProjects.XtraB
    );

INSERT OR REPLACE INTO client.LSOpenProjects SELECT * FROM newRows;
INSERT OR REPLACE INTO client.LSOpenSubProjects SELECT * FROM newRows;
INSERT OR REPLACE INTO client.LSOpenJobs SELECT * FROM newRows;

DELETE * FROM newRows;



Simon.
_______________________________________________
sqlite-users mailing list
[email protected]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


_______________________________________________
sqlite-users mailing list
[email protected]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to