WHERE IN for JOIN subquery?

2017-12-18 Thread Dave Johansen
I want to do a JOIN against a subquery that is doing an aggregation. The query itself is relatively straightforward, but has poor performance. Here it is: SELECT a.*, b.* FROM base AS a LEFT OUTER JOIN (SELECT other, COUNT(value), COUNT(DISTINCT value) FROM other GROUP BY other) AS

Re: WHERE IN for JOIN subquery?

2017-12-18 Thread Dave Johansen
On Mon, Dec 18, 2017 at 5:10 PM, David G. Johnston < david.g.johns...@gmail.com> wrote: > On Mon, Dec 18, 2017 at 5:00 PM, Dave Johansen > wrote: > >> >> other = a.other >> But I get this error: >> ERROR: invalid reference to FROM-clause entry for table &