开发者

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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜