select apply_date,sum(result='pass')/count(result) 审批通过率,sum((result='pass')*apply_prin)/sum(result='pass') 审批通过的平均申请金额 from app_list group by apply_date;
wo56565
2020-02-19
select driver_name,driver_phone from driver_info left join driver_collect on driver_info.driver_id=driver_collect.driver_id where d_year=2017 and d_month=7 group by driver_info.driver_id having count(
wo56565
2020-02-19
select count(id) from tbl_contract left join tbl_clue on tbl_contract.clue_id=tbl_clue.clue_id where date_format(tbl_clue.created_at,'%m-%d')='06-07' and date_format(tbl_contract.created_at,'%m-%d')='
wo56565
2020-02-19
select city_id,count(clue_id),avg(price) from tbl_clue where date_format(created_at,'%m-%d')='06-07' group by city_id order by count(clue_id) desc;
wo56565
2020-02-19
select sum(invest_amount) from cmn_investment_request a left join dim_agent b on a.user_id=b.user_id and created_at between start_date and end_date where agent_id='10002';
wo56565
2020-02-19
select user_id from cmn_investment_request where year(created_at)=2017 group by user_id having group_concat(distinct invest_item order by invest_item desc)='CFH,AX';
wo56565
2020-02-19
select user_id from cmn_investment_request where year(created_at)=2017 group by user_id having min(invest_amount)>500000;
wo56565
2020-02-19
-- MySQL实现全连接 -- select * from t1 full join t2 on key1=key2; select * from t1 left join t2 on key1=key2 union select * from t1 right join t2 on key1=key2;
wo56565
2020-02-19
-- 左连接 select * from t1 left join t2 on key1=key2; -- 右连接 select * from t1 right join t2 on key1=key2; -- 左反连接 select * from t1 left join t2 on key1=key2 where key2 is null; -- 右反连接 select * from
wo56565
2020-02-19
select * from t1 inner join t2 on key1=key2; select * from t1 join t2 on key1=key2; select * from t1,t2 where key1=key2;
wo56565
2020-02-19
select t_user.* from t_user left join t_order on t_user.userid=t_order.userid where month(end_time)=3;
wo56565
2020-02-19
select t_user.userid from t_user left join t_order on t_user.userid=t_order.userid where t_order.userid is null; select userid from t_user where userid not in (select userid from t_order);
wo56565
2020-02-19
# -*- coding:utf-8 -*- # author: import numpy '''数组的元素重复操作''' x = numpy.array([[1,2],[3,4]]) print(x.repeat(2)) # 按元素重复 [1 1 2 2 3 3 4 4] print(x.repeat(2,axis=0)) # 按行重复 [[1 2][1 2][3 4][3 4]] print(
wo56565
2019-07-18
# -*- coding:utf-8 -*- # author: import numpy '''ndarray数组重塑''' x = numpy.arange(0,6) #[0 1 2 3 4] print(x) #[0 1 2 3 4] print(x.reshape((2,3))) #) [[0 1 2][3 4 5]] print(x )#[0 1 2 3 4] print(x.resh
wo56565
2019-07-18
# -*- coding:utf-8 -*- # author: import numpy as np a=np.random.randint(0,10,100)#范围内的整数 print(a) b=np.random.rand(40)#0到1的均匀分布 print(b) c=np.random.randn(10)#标准正态分布 print(c) d=np.random.normal(0,1,10
wo56565
2019-07-18
# -*- coding:utf-8 -*- # author: import numpy '''ndarray的唯一化和集合运算''' x = numpy.array([[1,6,2],[6,1,3],[1,5,2]]) print(numpy.unique(x)) # [1,2,3,5,6] y = numpy.array([1,6,5]) print(numpy.in1d(x,y)) #
wo56565
2019-07-18
# -*- coding:utf-8 -*- # author: import numpy '''where函数的使用''' cond = numpy.array([True,False,True,False]) x = numpy.where(cond,-2,2) print(x) # [-2 2 -2 2] cond = numpy.array([1,2,3,4]) x = numpy.
wo56565
2019-07-18
# -*- coding:utf-8 -*- # author: import numpy '''ndarray数组的转置和轴对换''' k = numpy.arange(9) #[0,1,....8] m = k.reshape((3,3)) # 改变数组的shape复制生成2维的,每个维度长度为3的数组 print(k )# [0 1 2 3 4 5 6 7 8] print(m )# [[0
wo56565
2019-07-18
# -*- coding:utf-8 -*- # author: import numpy '''ndarray的布尔型索引''' x = numpy.array([3,2,3,1,3,0]) # 布尔型数组的长度必须跟被索引的轴长度一致 y = numpy.array([True,False,True,False,True,False]) print(x[y] )# [3,3,3] pri
wo56565
2019-07-18