Powerbook

SQL with multiple conditions

Discussion created by Powerbook on Jan 25, 2016
Latest reply on Jan 25, 2016 by Powerbook

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

Outcomes