Forum Discussion

Tony2021's avatar
Tony2021
Steel Contributor
Sep 18, 2024
Solved

Current Date in Select Query

Experts,    I am trying to make this query and I think I am pretty close but I dont know how to show the Current Date in the blue below?    SELECT T1.Expirey2,T1.AmountOfChange, T1.LCID (SELECT ...
  • Ken_Sheridan's avatar
    Ken_Sheridan
    Sep 18, 2024

    SELECT T1.Expirey2,T1.AmountOfChange, T1.LCID,
        (SELECT SUM(AmountOfChange)
         FROM qryLCAmends AS T2
         WHERE T2.LCID = T1.LCID
         AND T2.Expirey2 < DATE()) AS LCBalance
    FROM qryLCAmends AS T1
    ORDER BY LCID;

     

    This will return the detail rows returned by the outer query, and the sum of the AmountOfChange values for the current LCID value in each row?  Is that what's required, rather than returning the balance per transaction per subset of distinct LCID value?  If the latter, you might like to take a look at Balances.zip in my public databases folder at:

     

    https://1drv.ms/f/c/44cc60d7fea42912/EhIppP7XYMwggESpAAAAAAABaDKZCllSuweYBPJ5zKa3cg

     

    This little demo file illustrates a number of queries for returning balances in different contexts, either over all rows or per group.

Resources