sql的积累 By:山高似水深 原创 转载注明出处

1、REVERSE()  反转  
例如:124.205.58.30  结果03.85.502.421
Hive 可用

2016年12月3日11:31:59
2、instr(str,'.')位置
结果:得出在str中第一个'.' 的位置
hive可用

2016年12月3日11:32:04

3、substr(str,1,2)截取
结果:得出从str的开始截取,截取到第二位
hive可用

2016年12月3日11:32:07

4、
substring_index(str,'.',3)截取
结果:从str的开始截取,截取到第三个'.'的位置
hive不可用 mysql可用

2016年12月3日11:32:11

5、

insert into table city_rank select city,num,company from
(select city,count(distinct listings1)as num,company from salehouse where date='201609' and city is not null and length(city)>1 and length(city)<4 and company <> '独立经纪人' and length(company)>2 and length(company)<8 and length(listings1)>7 and length(listings1)<16 group by city,company order by city asc,num desc) order_num
where row_number(city) <= 5;

By:山高似水深

 

相关文章:

  • 2021-12-27
  • 2021-08-05
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-06-30
  • 2021-08-28
猜你喜欢
  • 2021-05-24
  • 2021-09-25
  • 2022-12-23
  • 2022-12-23
  • 2021-10-28
  • 2021-08-28
  • 2021-10-08
相关资源
相似解决方案