1

lets say i have a column uniqueID that had '1' in it. What I want to do is only update called phonenumber total. If it doesn't exist then insert. Is 'REPLACE into table' what I am looking for?

1
  • INSERT ... ON DUPLICATE KEY UPDATE Syntax Commented Mar 7, 2011 at 21:49

2 Answers 2

4

This is called an 'upsert' (UPdate/inSERT).

Examples at How to write flexible INSERT and UPDATE statements in MySQL

Sign up to request clarification or add additional context in comments.

1 Comment

I like it but it will slow everything down a lot, is there a way to say if ROW exists blah or else?
0

There is an SQL standard for this called "MERGE". Some recent version of Oracle and MSSQL2008+ support this. Not sure about MySQL

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.