ON DUPLICATE KEY UPDATE -- Query Modification
Posted: Tue Mar 04, 2008 3:52 am
Hi all,
Please have a look on following query:
As per my knowledge, "ON DUPLICATE KEY UPDATE" works in this way, "If record not exist then INSERT otherwise Update the existing record with reference of the Primary Key or Unique ID".
Here's a question:
I want to check IF the given URL is same as the existing URL then do nothing, otherwise INSERT or UPDATE.
Is it possible to modify the query to achieve this goal?
looking forward for your kind response,
WAQAS
Please have a look on following query:
Code: Select all
INSERT INTO league (ut,url,game,eID) VALUES (now(),'$url','s',$lid) ON DUPLICATE KEY UPDATE ut=VALUES(ut), url=VALUES(url)Here's a question:
I want to check IF the given URL is same as the existing URL then do nothing, otherwise INSERT or UPDATE.
Is it possible to modify the query to achieve this goal?
looking forward for your kind response,
WAQAS