I want to insert data into a table only when current dateTime1 column is not equal to the existing dateTime1 column in the table. I tried running the query below but it does not return valid result when mydate1 is null in the table.
INSERT INTO TableA (id, dateTime1, datetime2)
SELECT 123, mydate1, mydate2
WHERE NOT EXISTS (SELECT 1 FROM tableA
WHERE id=123 and dateTime1 <> mydate1)
Basically I want to insert data into the table only when the date column is not equal to the current date column that we are trying to insert.
insert ... on conflict?..