select count(*) from (select count(*) from 表名称 group by 多种数据量 ) 表名; 举个栗子: 比如说我有一个数据类型的字段, 里面有很多种的数据类型. 而且每个数据类型都有近些年的数据. 就是有很多重复的数据类型的数据. 我的目的就是查询出 数据类型的个数. 先查询出不重复的数据类型. select count(*) from 表名称 group by SJLX; 然后我们在用count(*) 查询这些条目数的总个数. select cou
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