postgresql - Postgres escape a single quote -
i have following postgres query:
select sum(cost) db id not in (<parameter>)
<parameter>
dynamic text field multiple id's need inserted. if type in
123, 456
as id's, results in:
select sum(cost) db id not in ('123,456')
which doesn't run properly.
i can change query, can't change input field. if type in
123','456
it results in:
select sum(cost) db id not in ('123'',''456')
when change query into:
select sum(cost) db id not in ('<parameter>')
and type in
123,456 results in:
select sum(cost) db id not in (''123'',''456'')
i've got working mysql, not postgresql. idea how trick postgresql?
try like:
select sum(cost) db id != all(('{'||'123,456'||'}')::numeric[])
it form array string input values : {123,456}
, cast array , check id against elements of array.
Comments
Post a Comment