背景1:时间段内存在重复的号码,号码去重后,统计时间段内号码数量
select count(*) from (select count(*) as num from table1 where MARKDATE >= to_date('2020-05-18','yyyy-mm-dd') and MARKDATE < to_date('2020-05-20','yyyy-mm-dd') group by phonenumber)
其他关键字用法说明:
1. group by说明:
group by 多个字段,字段顺序对查询结果数据无影响,只对排序有影响
2. concat用法:
select concat(id,',') from table
3. distinct用法:
select distinct province from table
4. limit用法:
select * from table limit 20