Postgres UPSERT
UPDATE "SC_Wonder" . "TMining_New" SET "FH_09_Q" = 100 , "FH_09_Fe" = 20 , "FH_09_ZnO" = 0 , "FH_09_S" = 0 WHERE "FMineObj_ID" = 7 AND "FDate" = '2015-01-28' ; INSERT INTO "SC_Wonder" . "TMining_New" ( "FDate" , "FMineObj_ID" , "FH_09_Q" , "FH_09_Fe" , "FH_09_ZnO" , "FH_09_S" ) SELECT '2015-01-28' , 7 , 100 , 20 , 0 , 0 WHERE NOT EXISTS ( SELECT 1 FROM "SC_Wonder" . "TMining_New" WHERE "FMineObj_ID" = 7 AND "FDate" = '2015-01-28' );