![](https://img-blog.csdnimg.cn/20201014180756925.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
mysql
kkkjjjkj
程序人生
展开
-
mysql语法用于数据库删除重复记录
删除重复记录,保存Id最大的一条DELETE FROM SHIP_INOUT_PORT_tmp WHERE mmsi IN ( SELECT mmsi FROM SHIP_INOUT_PORT_tmp GROUP BY mmsi ...原创 2018-03-19 11:49:20 · 204 阅读 · 0 评论 -
删除逐渐唯一索引,级联删除主键约束
--删除主键级联删除唯一索引alter table CBS_AG_CNTR_MTHD drop CONSTRAINT PK_CBS_AG_CNTR_MTHD cascade drop index;--创建主键级联创建唯一索引alter table CBS_AG_CNTR_MTHDadd constraint PK_CBS_AG_CNTR_MTHD primary key (CNTR_PACKG_U...原创 2018-03-20 17:17:45 · 417 阅读 · 0 评论 -
sql按分组获取多条数据中最新一条
用projectid 作为分组并按id排序,获取最新一条数据。oracle 、 mysql 用法select * from ( select row_number() over(partition by ProjectID order by [ID] desc ) as keyId,* from table ) as t where t.keyId = 1...原创 2019-09-12 10:21:10 · 2250 阅读 · 0 评论