I'm quite custom with SQL scripts, but I'm having some problems with filemaker syntax.

up to now I was able to perform a sum with just one condition, in the following case I'm summarizing all values of "Entrate" from the Table "Movimenti" that have a correspondence value of "R1A" in the field "Causale 3"

*Sum(*

*Substitute(*

*ExecuteSQL ("SELECT SUM (\"Entrate\" ) FROM \"Movimenti\" WHERE (\"Causale 3\") = ?" ; "" ; "" ; "R1A");".";",")*

(the Substitute is for compatibility with European decimal between Windows and Mac OS systems)

what I would need now is to add more conditions to the extraction.

Like a range of date that I have already stored in 2 Variables "$DataInizio" and "$DataFine" and also when the field "ID Tecnico" has a correspondence to the variable "$Tecnico"

in few word I would need to extract from the table "Movimenti" and summarize the field "Entrate" in a range of date when the "ID Tecnico" is equal to $Tecnico.........

How would be the correct syntax to use in a script for filemaker ?

Thank you

you can chain things together with AND / OR

Where field = ? AND Where Field = ? OR WHERE Field2 <> ? is valid when you put in three arguments.

What is the substitute and Sum for?

You are asking SQL to return a sum already and the delimiters can be specified right in the ExecuteSQL ()

ExecuteSQL ("SELECT SUM (\"Entrate\" ) FROM \"Movimenti\" WHERE (\"Causale 3\") = ?" ; "." ; "," ; "R1A")The Missing FM 12 ExecuteSQL Reference | FileMakerHacks