1.行转列:有两种写法,一种是case when end写法,另一种写法是pivot(oracle 11g新增) select job, then sal end) as sal10, then sal end) as sal20, then sal end) as sal30, sum(sal) as allsal from emp group by job ; select * from (select job,sal,deptno from emp) pivot( , as d30)) ;
hive里的group by和distinct 前言 今天才明确知道group by实际上还是有去重读作用的,其实细想一下,按照xx分类,肯定相同的就算是一类了,也就相当于去重来,详细的看一下. group by 看一下实例1: hive> select * from test; OK zhao 15 20170807 zhao 14 20170809 zhao 15 20170809 zhao 16 20170809 hive> select name from test; OK zhao