select * from bdcdj.lqentry1 a where 顺序号 in (select max(顺序号) from bdcdj.lqentry1 b WHERE b.archival_code IS NOT NULL group by archival_code): 通过archival_code分组 ,取顺序号的最大值.
1.表数据结构如下 select * from test t , 'jerry'); , 'jerry'); , 'jerry'); , 'tom'); , 'tom'); , 'jake'); , 'jake'); , 'jake'); 2.删除sql如下 a.name去重,取最小的字段 b.使用exists删除重复的数据 delete test a where not exists ( select * from (select min(id) id, name from test grou