Execute Sql with 2 conditions

Discussion created by cmj on Nov 22, 2018
Latest reply on Nov 24, 2018 by beverly

I've been trying numerous iterations with no luck for what should be simple.

I want to get a value from a previous record where the fk is the same and the year is one less than the current record.

Note that LoanFC_Year is a text field and the calculation: LoanFC_Year -1 does return the correct value.

The fk is a number and LoanFC_LastPymtDateYearly is a date.

This calculation should return a date.


ExecuteSQL ( "SELECT Sum(LoanFC_LastPymtDateYearly)

FROM Loan_Forecast

WHERE ? = LoanFCfkLoanID 

AND LoanFC_Year  = ?"


; "" ; "" ; ""; LoanFCfkLoanID; LoanFC_Year -1)

All I get is ?

Thank You