Re: Finding sequential records - Mailing list pgsql-sql

From Richard Broersma
Subject Re: Finding sequential records
Date
Msg-id 396486430809261808g4565d6c9l4fd1b98a2ab900e7@mail.gmail.com
Whole thread Raw
In response to Finding sequential records  (Steve Midgley <science@misuse.org>)
List pgsql-sql
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


pgsql-sql by date:

Previous
From: "Oliveiros Cristina"
Date:
Subject: Re: Finding sequential records
Next
From: Steve Midgley
Date:
Subject: Re: Finding sequential records