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

  • 相关阅读:
    Write an algorithm such that if an element in an MxN matrix is 0, its entire row and column is set to 0.
    旋转二维数组
    replace empty char with new string,unsafe method和native implementation的性能比较
    判断一字符串是否可以另一字符串重新排列而成
    移除重复字符的几个算法简单比较
    也来纠结一下字符串翻转
    判断重复字符存在:更有意义一点
    程序员常去网站汇总
    sublime
    针对程序集 'SqlServerTime' 的 ALTER ASSEMBLY 失败,因为程序集 'SqlServerTime' 未获授权(PERMISSION_SET = EXTERNAL_ACCESS)
  • 原文地址:https://www.cnblogs.com/howie/p/2471396.html
Copyright © 2011-2022 走看看