sql - Pass a query inside Where in () -
i have query looking this,
select * tbl1 field1 in (select field2 tbl2 id=1) - where field1 of type integer
- and
select field2 tbl2 id=1return '1,2,3' string
obviously, cannot pass string in order check field of type integer. asking is, how fix above query? or there alternate solution this?
my dbms : postgresql 9.0.3
select * tbl1 field1 in ( select regexp_split_to_table(field2, ',')::int tbl2 id=1 ) variation suggested igor
select * tbl1 field1 = ( select regexp_split_to_array(field2, ',')::int[] tbl2 id=1 )
Comments
Post a Comment