应对没完没了的报表开发
应对没完没了的报表开发 – esproc for reporting | 润乾 -pg游戏官网登录入口
简单开发 · 丰富格式 · 多样源 · 轻量级 · 高性能
select customer, amount, sum_amount from (select customer, amount, sum(amount) over(order by amount desc) sum_amount from (select customer, sum(amount) amount from orders group by customer)) where 2 * sum_amount < (select sum(amount) total from orders)
a | b | |
1 | =db.query("select customer,amount from orders order by amount desc") | |
2 | =a1.sum(amount)/2 | =0 |
3 | =a1.pselect((b1 =amount)>=a2) | return a1.to(a3) |
with first_login as ( select userid, min(trunc(ts)) as first_login_date from login_data group by userid), next_day_login as ( select distinct(fl.userid), fl.first_login_date, trunc(ld.ts) as next_day_login_date from first_login fl left join login_data ld on fl.userid = ld.userid where trunc(ld.ts) = fl.first_login_date 1), day_new_users as ( select first_login_date,count(*) as new_user_num from first_login group by first_login_date), next_new_users as ( select next_day_login_date, count(*) as next_user_num from next_day_login group by next_day_login_date), all_date as ( select distinct(trunc(ts)) as login_date from login_data) select all_date.login_date 1 as dt,dn. new_user_num,nn. next_user_num, (case when nn. next_day_login_date is null then 0 else nn.next_user_num end)/dn.new_user_num as ret_rate from all_date join day_new_users dn on all_date.login_date=dn.first_login_date left join next_new_users nn on dn.first_login_date 1=nn. next_day_login_date order by all_date.login_date;
a | |
1 | =file(“login_data.csv”).import@tc() |
2 | =a1.group(userid;fst=date(ts):fst_login,~.(date(ts)).pos(fst 1)>0:w_sec_login) |
3 | =a2.groups(fst_login 1:dt;count(w_sec_login)/count(1):ret_rate) |
a | b | |
1 | fork to(12) | =connect("oracle") |
2 | =b1.query@x("select * from customer where mod(c_custkey,?)=?", n, a1-1) | |
3 | =a1.conj() |
a | b | |
1 | select * from supplier | |
2 | select * from part | |
3 | select * from customer | |
4 | select * from partsupp | |
5 | select * from orders | |
6 | fork [a1:a5] | =connect("oracle") |
7 | =b6.query@x(a6) |
a | |
1 | =file(sales.txt).import@t() |
2 | =a1.select(od>=20240101) |
3 | =a2.groups(area,emp;sum(amount):amount) |
a | |
1 | =file(sales.txt).cursor@t() |
2 | =a1.select(od>=20240101) |
3 | =a2.groups(area,emp;sum(amount):amount) |
a | |
1 | =file(sales.txt).import@tm() |
2 | =a1.select(od>=20240101) |
3 | =a2.groups(area,emp;sum(amount):amount) |
a | |
1 | =file(sales.txt).cursor@tm() |
2 | =a1.select(od>=20240101) |
3 | =a2.groups(area,emp;sum(amount):amount) |