zoukankan      html  css  js  c++  java
  • 数据导入CPP

    select 机构名称,count(机构名称)[机构名称重复个数],count(公司地址)[地址重复个数] from dbo.Excel402 group by 机构名称
    having count(机构名称)>1 and count(机构名称)<>count(公司地址)
    
    select 机构名称,count(机构名称)[机构名称重复个数],count(公司地址)[地址重复个数]
    into #tbgroub from dbo.Excel402 group by 机构名称
    
    select 机构名称 into #tb2 from #tbgroub where 机构名称重复个数>1 and 机构名称重复个数=地址重复个数
    select * from #tb2
    select * from dbo.Excel402 where 机构名称 in (select 机构名称 from #tbgroub where 机构名称重复个数>1 and 机构名称重复个数=地址重复个数 )
    
    select (select top 1 code from Excel402 a where a.机构名称=#tb2.机构名称)[code2]
    into #tbcode from #tb2
    
    select * from #tbcode
    select * into TestTb from dbo.Excel402 where Code in (select * from #tbcode)
    select * from TestTb
    --drop table TestTb
    
    update TestTb set TestTb.办公电话=TestTb.办公电话+','+[电话1],
    TestTb.邮箱地址=TestTb.邮箱地址+','+[邮箱1],
    TestTb.传真=TestTb.传真+','+[传真2]
    from TestTb inner join 
    (select 机构名称,办公电话 [电话1],传真[传真2],邮箱地址 [邮箱1] from Excel402
     where 机构名称 in (select * from #tb2) and Code not in (select * from #tbcode )) b
    on TestTb.机构名称=b.机构名称
    
    
    
    
  • 相关阅读:
    ADO之connection
    函数及自定义函数
    母版页
    XHTML5 与 HTML 4.01的差异
    三层架构的使用
    ExecuteNonQuery&& ExecuteQuery 区别
    常用数据结构的时间复杂度
    图像处理(卷积)作者太棒了
    C#中标准Dispose模式的实现
    计算机网络知识点
  • 原文地址:https://www.cnblogs.com/hdl217/p/1991911.html
Copyright © 2011-2022 走看看