首页 > 代码库 > 项目笔记2

项目笔记2

daily price中应该有联合主键,这样插入就不会重复了,不过不要紧。

组合主键

alter table tb_ul_daily add PRIMARY KEY(ul_id,trading_date)

删除重复记录

delete from tb_ul_daily  where id in (select id from (select  max(id) as id,count(trading_date) as count from tb_ul_dailygroup by trading_date having count >1 order by count desc) as tab )