u_where clause not hardcoded
Author: email@example.com (ncolmart)
I would like to use a selectdb with a u_where clause on a field containing more or less values.
The problem is that values to evaluate are only known at runtime.
selectdb sum(fieldA) from "TABLE" u_where (fieldB="1" | fieldB="2")
selectdb sum(fieldA) from "TABLE" u_where (fieldB="1" | fieldB="3" | fieldB="5" | fieldB="7" | fieldB="9")
So, I don't know in advance the number of values to evaluate and of course the values themselves.
A solution could be to initialize the fieldB with the list of values, then a retrieve, then a loop, and doing the sum for each record.
But this will fetch to much data and slow down the process.
I would prefer the selectdb as the 'sum' will be made by the DBMS.
Any Idea ?