### Title

ExecuteSQL - 2 tables - 3 form variables Question

### Post

Hi,

New to FileMaker & it's ExecuteSQL function.

Wondering if anyone has used this function with success on getting a result for the current record in a form?

Not sure this is enough info tto solve as the FMP is more elborate but this is the deal breaker calculation for me.

I have 2 tables:**FiltersForm** - form with the variables to pass - Using:** Hours_Start**, **Hours_End**, **ModelForm****FiltersDB** - the data to read from - Using: **Model** ,**FilterYes**, **Hours**

Tried:

ExecuteSQL ( "select sum ( filterYes ) from FiltersDB join FiltersForm on FiltersDB.Model = FiltersForm.Modelform where ( FiltersDB.Hours >= FiltersForm.Hours_Start and FiltersDB.Hours <= FiltersForm.Hours_End and FiltersDB.Model = '120H' ) ";"";"" )

ExecuteSQL ( "select sum ( filterYes ) from FiltersDB join FiltersForm on FiltersDB.Model = FiltersForm.Modelform where ( FiltersDB.Hours >= FiltersForm.Hours_Start and FiltersDB.Hours <= FiltersForm.Hours_End and FiltersDB.Model = FiltersForm.ModelForm ) ";"";"" )

Can't seem to get it to work passing the model variable using another "And" or using "Having"?

The Sum result is also incorrect and doesn't seem to be looking at the current record

Thanks

Nick

In which table did you define this calculation? FiltersForm or FiltersDB?

Did you define this in an unstored calculation field or in something else?