I am trying to do a query which updates if 'ID' exists and inserts if it doesn't exists. When the tried to run the following query, i could see so many duplicate records being inserted. I dont know what i am doing wrong. My query is below. Id is the 'Autoincrement' and 'KEY'. I am not getting any query Errors. DB is MysqlI am trying to do a query which updates if 'ID'