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)

  • 相关阅读:
    MkDocs: 构建你自己的知识库
    Vue入门
    Vue UI库
    【入门】PyTorch
    【转载】工业相机的原理与选型
    如果你是狮子,就得学会逼狼去吃草
    【转载】剖析Git的实现机制
    管理学-员工管理
    量化投资
    【汇总】图像格式
  • 原文地址:https://www.cnblogs.com/samsonleung/p/1239809.html
Copyright © 2011-2022 走看看