optimize sql request

Hello,    I am using the db connector module to make some request on an external DB, I am facing some latency issue on one of my process, because I need to make several request (in a loop) to retrieve different result, If a find a way to make only one request, it would remove that latency issue. This is my request that I am calling several time (in a loop) :  select  $dynamicValue1 * sum(amoutAttr) as value1, nameDB$attr1, nameDB$attr2, from nameDB$table where nameDB$attr3 >$dynamicValue2 group by nameDB$attr1, nameDB$attr2;   I would like to call it one time only (remove the loop), I can put several things in the select option, but I do not succeed to adapt the where clause :   select  $dynamicValue1 * sum(amoutAttr) as value1, $dynamicValue2 * sum(amoutAttr) as value2, $dynamicValue3 * sum(amoutAttr) as value3, nameDB$attr1, nameDB$attr2, from nameDB$table where nameDB$attr3 >$dynamicValue4 (this should apply on value1 only) and nameDB$attr3 >$dynamicValue5 (this should apply on value2 only) and nameDB$attr3 >$dynamicValue6 (this should apply on value3 only) group by nameDB$attr1, nameDB$attr2;   Do you know how / if I can do that?    Thanks!
1 answers

You can place them in a list:

where nameDB$attr3 in ($dynamicValue4, $dynamicValue5, $dynamicValue6)