as in the title said I want to either insert a new value or if its primary key already existant update the row but only if the database value is older than the given new one.
the query is something like this but it has problems with the where statement
INSERT INTO myTable(field1_key, field2, datefield) VALUES('val1', 'val2', '2012-12-12 12:12:12')
ON DUPLICATE KEY UPDATE
field2='val2'
datefield='2012-12-12 12:12:12'
WHERE datefield <'2012-12-12 12:12:12'
If it’s newer just “replace” it with the same value: