ExecuteSQL is Executing Me

Discussion created by cmj on Aug 17, 2018
Latest reply on Aug 19, 2018 by BruceHerbach

1)This works fine.

The EQ calculation takes place in a field called Results_YearlyIncome in the Results table.

This provides a sum of income by year from the Income table that corresponds with records "Year" in the Results table.

Note that "Year" is only a number (e.g. 2018)


Round(ExecuteSQL ( "SELECT SUM (Income.Inc_YearAmtIndexed)


FROM Income


WHERE ? = Income.Inc_Year"


;"";"";Results_Year );2)



2)To find the minimum income value across all the Years I use the following calculation that looks to the Income table and is stored in the Results table in a field called Results_Minimum_Income_YearAmtIndexed.


Round(Min (Income::Inc_YearAmtIndexed_Total_ByYear);2)



3)Now I wish to find the Year in which the minimum income occurs in. I've tried:


ExecuteSQL ( "SELECT DISTINCT (Income.Inc_Year)


FROM Income


WHERE ? = Round(Min (Income.Inc_YearAmtIndexed_Total_ByYear);2) "




All that's returned is ?


I'm brand new to ExecuteSQL and have reviewed many examples. It's just not sinking in... Any help on this would be greatly appreciated.