I have a procedure which I am trying to get to select the results based on the value of a measure being above a stated parameter. However, I would like the greater than to be changable to equals or less than.
I have tried substituting the > for a parameter, but it gives me the error: sql syntax error: incorrect syntax near "PARAM_OP" (Where PARAM_OP is the name of the parameter which should be substituted for ther operator.
Any ideas would be welcome.
Code below:
var_out =
SELECT
"Col1" AS "Col1",
"Col2" AS "Col2",
"Col3" AS "Col3",
SUM(Col4) AS "Col4"
FROM <schema>.<view>
WHERE "Col2" = PARAM_1
GROUP BY Col1, Col2, Col3
HAVING SUM(Col4) > PARAM_2
ORDER BY SUM(Col4);