几个sql语句
2016-12-06 17:45
302 查看
select count(distinct(company_name)) from bj_capital 60/69 select count(distinct(company_name)) from bj_capital2 134/193 SELECT company_name FROM bj_capital UNION SELECT company_name FROM bj_capital2 194/262 create table clue.bj_union_capital as SELECT distinct c.company_name,c.reg_no, c.city, c.bus_scope FROM clue.clue c JOIN (SELECT company_name FROM bj_capital UNION SELECT company_name FROM bj_capital2) b ON c.company_name = b.company_name where length(bus_scope)>=6 and length(reg_no)>=15 select count(1) from bj_union_capital 62 select sum(case when bus_scope like '%钢铁%' or bus_scope like '%汽车%' or bus_scope like '%船舶%' or bus_scope like '%石化%' or bus_scope like '%纺织%' or bus_scope like '%轻工%' or bus_scope like '%有色金属%' or bus_scope like '%装备制造%' then 1 else 0 end) type_cnt ,sum(case when bus_scope like '%预防性疫苗%' or bus_scope like '%治疗性疫苗%' or bus_scope like '%诊断试剂%' then 1 else 0 end) type2_cnt ,sum(case when bus_scope like '%新型医用植入器械%' or bus_scope like '%人工器官%' or bus_scope like '%医学影像诊断设备%' or bus_scope like '%微创诊疗设备%' or bus_scope like '%新型肿瘤治疗装置%%' then 1 else 0 end) type3_cnt ,sum(case when bus_scope like '%秸秆成型燃料%' or bus_scope like '%秸秆气化%' or bus_scope like '%秸秆干馏%' or bus_scope like '%秸秆能源化%' then 1 else 0 end) type4_cnt ,sum(case when bus_scope like '%信息技术%' or bus_scope like '%生物和医药技术%' or bus_scope like '%新材料技术%' or bus_scope like '%先进制造技术%' or bus_scope like '%资源环境技术%' or bus_scope like '%海洋技术%' or bus_scope like '%现代农业技术%' or bus_scope like '%现代交通技术%' or bus_scope like '%地球观测与导航技术%' then 1 else 0 end) type5_cnt ,sum(case when ic_cap>10000000 then 1 else 0 end) type6_cnt ,sum(case when ic_cap>30000000 then 1 else 0 end) type7_cnt from clue a select sum(case when bus_scope regexp '担保' then 1 else 0 end) type_cnt ,sum(case when bus_scope regexp '技术进出口' then 1 else 0 end) type2_cnt ,sum(case when bus_scope regexp '货物进出口' then 1 else 0 end) type3_cnt ,sum(case when bus_scope regexp '融资' then 1 else 0 end) type4_cnt ,sum(case when bus_scope regexp '文化艺术' then 1 else 0 end) type5_cnt ,sum(case when bus_scope regexp '演出' then 1 else 0 end) type6_cnt ,sum(case when bus_scope regexp '生物试剂' then 1 else 0 end) type7_cnt ,sum(case when bus_scope regexp '生物技术' then 1 else 0 end) type8_cnt from clue a bus_scope regexp '钢铁|汽车|船舶|石化|纺织|轻工|有色金属|装备制造'
相关文章推荐
- SQL中的三值逻辑
- SQL Server 作业批量停止
- 结束SQL阻塞的进程
- 动态生成SQL Server视图作业
- SQL Server 语句操纵数据库
- SQL(结构化查询语句)
- oracle sql日期比较
- linux快速部署mysql服务器
- 10 件在 PHP 7 中不要做的事情
- sql 存储过程分页
- 在WINXP系统上安装SQL Server企业版的方法
- 通过批处理调用SQL的方法(osql)
- SQL Server 存储过程的分页
- ASP程序与SQL存储过程结合使用详解
- SQL SERVER编写存储过程小工具
- 防御SQL注入攻击时需要注意的一个问题
- SQL Server 中 RAISERROR 的用法详细介绍
- Microsoft Sql server2005的安装步骤图文详解及常见问题解决方案