- group by后根据count排序
select name,count(*) pc from crv.credit_xuke where cast(createtime as bigint)>1603641600000 group by name order by pc desc
这样不行,改为嵌套一层
select new_t.name,new_t.pc from
(select name,count(*) pc
from crv.credit_xuke
where cast(createtime as bigint)>1603641600000
group by name ) new_t
order by new_t.pc desc
load data inpath ‘/tmp/sql2csv/aijian_idcards.dat’ into table tmpdb.aijian_idcards ;