Thanks, I read the link and received the following error:
ERROR: aggregates not allowed in WHERE clause
Using the example:
WHERE g1.gid = 1 and g1.gid <> g2.gid
The error occurs if the function:
=1
is replaced by:
SUM(1000)
Another question: what does '<>' mean? Couldn't find explanation in the manual.