C# MySql if record exists update else insert?
lets say i have a column uniqueID that had '1' in it. What I want to do is only update called phonenumber 开发者_Python百科total. If it doesn't exist then insert. Is 'REPLACE into table' what I am looking for?
This is called an 'upsert' (UPdate/inSERT).
Examples at How to write flexible INSERT and UPDATE statements in MySQL
There is an SQL standard for this called "MERGE". Some recent version of Oracle and MSSQL2008+ support this. Not sure about MySQL
精彩评论