Forum Discussion

Tony2021's avatar
Tony2021
Steel Contributor
Aug 30, 2024

Day Count Query

Hello Experts,   I am having issues making a day count query for 3 criteria.   I have a 1 table with tblDraws.[FundingDate] and I need to make a day count between the [FundingDate] but the criter...
  • Ken_Sheridan's avatar
    Ken_Sheridan
    Sep 01, 2024

    Is this what you mean?

    SELECT D1.*,
        NZ((SELECT MIN(FundingDate)
               FROM tblDraws AS D2
               WHERE D2.ProjID = D1.ProjID
               AND D2.Type = D1.Type
               AND D2.FundingDate > D1.FundingDate)-FundingDate,0) AS DayCount
    FROM tblDraws AS D1
    ORDER BY ProjID, Type, FundingDate;

Resources