I have (with villeroy's generous help) created tables, query's etc to add due dates to a project. The duedates are stored in table DUEDATES Values are inserted from a view "zDateTemplate1Filter" using the following:
Code: Select all
INSERT INTO DUEDATES (SELECT ""zDateTemplate1Filter"".*, NULL AS ID, NULL AS DONE FROM ""zDateTemplate1Filter"")
Code: Select all
UPDATE "DUEDATES"
SET "DUE" = Select "DUE" FROM "zDateTemplate1Filter" WHERE "DUEDATES"."REMARK" = "zDateTemplate1Filter"."DESCR"
what I am trying to do is one sql that will update if existing on a per record basis, otherwise insert the record. In other words, for each record in zDateTemplate1Filter, if there is record in DUEDATES that matches both PID and DESCR, then update, otherwise insert.
Any thoughts on the best way to construct?