sql - postgres: use of CASE and ANY() in WHERE clause -
is there way make work?
select * table t inner join othertable t2 using (tid) t.tid = case when t2.someboolval any(array[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16]) else any(array[77,66]) end
unfortunately can't t.tid = case when t2.someboolval 1 else 2 end
because need match against array. doable?
use and/or. like:
select * table t inner join othertable t2 using (tid) t2.someboolval , t.tid in (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16) or not (t2.someboolval) , t.id in (77,66)
edit: formatted
Comments
Post a Comment