On Fri, Sep 26, 2008 at 3:25 PM, Steve Midgley <science@misuse.org> wrote:
> This returns an error:
>
> ERROR: column "dummy.id" must appear in the GROUP BY clause or be used in an
> aggregate function
> SQL state: 42803
Oops that what I get for trying air code :(
This works instead:
SELECT D1.* FROM Dummy AS D1
INNER JOIN Dummy AS D2 ON (D1.name,D1.fkey_id)=(D2.name,D2.fkey_id) AND (D1.id = D2.id + 1 OR D1.id = D2.id
-1 )
ORDER BY D1.id;
--
Regards,
Richard Broersma Jr.
Visit the Los Angeles PostgreSQL Users Group (LAPUG)
http://pugs.postgresql.org/lapug