mysql insert update语句
执行这条语句,会帮你自动判断数据库中是否有与你要插入的记录重复主键,有则更新,没有就插入
格式如:insert into tablename(字段1,字段2,。。。。) select * from (select ? 字段1,? 字段2,.... from dual) as b on duplicate key update 字段1=b.字段1,....
例子:insert into trtb_dim_top_cats(cid,parent_cid,name,is_parent,status,sort_order,lev)
select * from (select ? cid,? parent_cid,? name,? is_parent,? status,? sort_order,? lev from dual)
as b on duplicate key update cid=b.cid,parent_cid=b.parent_cid,name=b.name,is_parent=b.is_parent,status=b.status,sort_order=b.sort_order,lev=b.lev
相关推荐
herohope 2020-07-18
mrandy 2020-07-04
Jaystrong 2020-06-27
debugjoker 2020-06-17
好记忆也需烂 2020-04-21
achiverhai 2020-04-16
vivenwan 2020-04-08
要啥自行车一把梭 2020-03-20
Accpcjg 2020-02-22
王艺强 2020-11-17
anchongnanzi 2020-09-21
84296033 2020-09-15
heimu 2020-08-02
89921334 2020-06-26
Linkaibin 2020-06-14
fanhuasijin 2020-06-14
Laxcus大数据技术 2020-06-13
hanshangzhi 2020-06-10