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)

  • 相关阅读:
    DDD领域驱动设计的理解
    设计原则
    毫秒级的时间处理图片
    同步设施
    ASP.NET Core 中文文档
    Jenkins快速搭建持续集成
    刮刮卡
    网页WEB打印控件
    nginx+memcached+ftp上传图片+iis
    通过Jexus 部署 dotnetcore
  • 原文地址:https://www.cnblogs.com/samsonleung/p/1239809.html
Copyright © 2011-2022 走看看