zoukankan      html  css  js  c++  java
  • 时间差值

    alter procedure Asset_spQueryAlertInfomation
    (
     @pi_Action VARCHAR(100),
     @pi_InfoId BIGINT,
     @pi_pageIndex INT,
     @pi_pageSize INT,
     @po_recordCount BIGINT OUTPUT
    )
    as
     DECLARE @pt_StartRowIndex INT
     DECLARE @pt_EndRowIndex INT
     
     SET @pt_StartRowIndex = (@pi_pageIndex - 1) * @pi_pageSize + 1
     SET @pt_EndRowIndex = @pi_pageIndex * @pi_PageSize

    IF @pi_Action = 'getlist'
     BEGIN
    SELECT * FROM
      (
    SELECT   Asset_ReceiptDetail.InfoId,  Asset_Subject.SubjectCode, Asset_Subject.SubjectName, Asset_Contract_ChargePlan.CostStartDate, Asset_Contract_ChargePlan.CostEndDate,
             Asset_Contract_ChargePlan.ShouldGetDate, Asset_Contract_ChargePlan.SumMoney, Asset_ReceiptMain.ContractCode,
             Asset_Contract_ChargePlan.ChargePlanCode, Asset_ReceiptDetail.IsReceipt,
    ROW_NUMBER() OVER (ORDER BY Asset_Contract_ChargePlan.InfoId DESC) AS RowIndex,
    'IsReceipts' = (
       CASE
       WHEN IsReceipt = 0 THEN '否'
                            when IsReceipt is null then '否'
       ELSE
        '是'
       End)
    FROM     Asset_ChargedItems INNER JOIN
             Asset_Contract_ChargePlan ON Asset_ChargedItems.ChargedItemCode = Asset_Contract_ChargePlan.ChargedItemCode INNER JOIN
             Asset_Subject ON Asset_ChargedItems.SubjectCode = Asset_Subject.SubjectCode INNER JOIN
             Asset_ReceiptMain ON Asset_Contract_ChargePlan.ContractCode = Asset_ReceiptMain.ContractCode LEFT JOIN
             Asset_ReceiptDetail ON Asset_Contract_ChargePlan.ChargePlanCode = Asset_ReceiptDetail.ChagePlanCode
    WHERE datediff(day,getdate(),Asset_Contract_ChargePlan.ShouldGetDate)<=30 and  datediff(day,getdate(),Asset_Contract_ChargePlan.ShouldGetDate)>=0

    --应收日期与当前日期差值小于30天的记录同时是正值

    )tba
      WHERE RowIndex BETWEEN @pt_StartRowIndex AND @pt_EndRowIndex

    SELECT @po_recordCount = COUNT(*)
    FROM     Asset_ChargedItems INNER JOIN
             Asset_Contract_ChargePlan ON Asset_ChargedItems.ChargedItemCode = Asset_Contract_ChargePlan.ChargedItemCode INNER JOIN
             Asset_Subject ON Asset_ChargedItems.SubjectCode = Asset_Subject.SubjectCode INNER JOIN
             Asset_ReceiptMain ON Asset_Contract_ChargePlan.ContractCode = Asset_ReceiptMain.ContractCode LEFT JOIN
             Asset_ReceiptDetail ON Asset_Contract_ChargePlan.ChargePlanCode = Asset_ReceiptDetail.ChagePlanCode
    WHERE datediff(day,getdate(),Asset_Contract_ChargePlan.ShouldGetDate)<=30 and  datediff(day,getdate(),Asset_Contract_ChargePlan.ShouldGetDate)>=0

    end

  • 相关阅读:
    [转]批处理for命令使用指南
    批处理命令学习
    【树】Count Complete Tree Nodes
    【树】Flatten Binary Tree to Linked List(先序遍历)
    【树】Kth Smallest Element in a BST(递归)
    巧用border特性实现聊天气泡效果
    【树】Lowest Common Ancestor of a Binary Tree(递归)
    【树】Path Sum II(递归)
    【树】Populating Next Right Pointers in Each Node
    【树】Serialize and Deserialize Binary Tree
  • 原文地址:https://www.cnblogs.com/howie/p/2471396.html
Copyright © 2011-2022 走看看