Hi all I have the following query that sources two tables: select pi2.* from allpoints2 a1 inner join prem_info pi2 on pi2.prem = a1.prem AND the_geom is null AND pi2.multiplier > 1 where route in (select route from prem_info pi inner join allpoints2 a on a.prem = pi.prem where feederid = '241/6-210' group by route) is it possible to rewrite the query so that i can filter for feederid outside of a subselect, (so that i could call it from a view maybe) or should i do a set returning function ?