kettle-实现每个分组的前N的数据

2019独角兽企业重金招聘Python工程师标准>>> hot3.png

第一步:创建表及数据:

create table uid(
 uid int, --uid
 cate varchar(20), --类别
 price double --金额
)
insert into uid values(123,'c1',21);
insert into uid values(123,'c2',23);
insert into uid values(123,'c3',14);
insert into uid values(123,'c4',25);
insert into uid values(123,'c8',10);
insert into uid values(124,'c1',28);
insert into uid values(124,'c15',25);
insert into uid values(124,'c2',12);
insert into uid values(124,'c31',40);
insert into uid values(124,'c7',15);

查询结果:kettle-实现每个分组的前N的数据_第1张图片

第二步:取uid的金额最多的前四名

1.获取所有记录kettle-实现每个分组的前N的数据_第2张图片

2.增加序列并过滤(增加序列需要排序):

kettle-实现每个分组的前N的数据_第3张图片

4.完成并查询结果:

kettle-实现每个分组的前N的数据_第4张图片

 

 

 

转载于:https://my.oschina.net/ilovetao/blog/859609

你可能感兴趣的:(python)