rewriting query to move filter conditionout of a subselect - Mailing list pgsql-general

From Rhys Stewart
Subject rewriting query to move filter conditionout of a subselect
Date
Msg-id 189966030610110706w7bf81794mcb1354cd41a3aa68@mail.gmail.com
Whole thread Raw
List pgsql-general
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 ?

pgsql-general by date:

Previous
From: Simon Riggs
Date:
Subject: Re: How does PG access wal files?
Next
From: Tom Lane
Date:
Subject: Re: query log corrupted-looking entries