Bradley Kieser <brad(at)kieser(dot)net> writes:
> When I run it, it returns 36 rows.
> Now, if I cut and paste simply the SELECT part and run it, I get the
> correct number of rows, 170.
If you can reproduce this on something more recent than 7.1, I'd
appreciate seeing a complete (self-contained) example. I recall having
seen some problems like this with INTERSECT/EXCEPT queries, but not
with plain inner joins ...
regards, tom lane