zoukankan      html  css  js  c++  java
  • 创建一个存储过程,查询在校生

    一直都是临时写语句,现在一次性建立存储过程,日后直接调用就好。

    create procedure sp_zaixiao
     
    as
    declare @curyear int
    declare @curmonth int 
    declare @tolrow int
    declare @strsql varchar(200)
    set @curyear=year(getdate())
    set @curmonth=month(getdate())
    if @curmonth>7 
     
    select case
            
    when dwdm='4420000' then '校本部'
            
    else '分校'
            
    end as '单位',
                
    count(xh) as '人数' from xsjbdab where xjztdm='1' and nj>(@curyear-3)  and xslbdm<>'61'
            
    group by (case
            
    when dwdm='4420000' then '校本部'
            
    else '分校'
            
    end)
    else
      
    select case
            
    when dwdm='4420000' then '校本部'
            
    else '分校' end as '单位',
             
    count(xh) as '人数' from xsjbdab where xjztdm='1'   and xslbdm<>'61'
                 
    and( nj>(@curyear-3or (nj=(@curyear-3and zsjj='3'))
       
    group by (case
            
    when dwdm='4420000' then '校本部'
            
    else '分校'
            
    end)

  • 相关阅读:
    tempfile 模块
    gc 模块
    hashlib 加密模块
    optparse模块
    ios网络相关问题-HTTPS与网络安全
    Charles抓包原理
    ios网络相关问题-HTTP特点
    ios网络相关问题-HTTP协议
    React-Native package.json、node_modules等文件说明
    Swift 4.0 中的 open,public,internal,fileprivate,private
  • 原文地址:https://www.cnblogs.com/samsonleung/p/1239809.html
Copyright © 2011-2022 走看看