Re: Finding sequential records

From: "Richard Broersma" <richard(dot)broersma(at)gmail(dot)com>
To: "Steve Midgley" <science(at)misuse(dot)org>
Cc: pgsql-sql(at)postgresql(dot)org, oliveiros(dot)cristina(at)marktest(dot)pt
Subject: Re: Finding sequential records
Date: 2008-09-27 01:08:35
Message-ID: 396486430809261808g4565d6c9l4fd1b98a2ab900e7@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Fri, Sep 26, 2008 at 3:25 PM, Steve Midgley <science(at)misuse(dot)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

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Steve Midgley 2008-09-30 02:48:09 Re: Finding sequential records
Previous Message Oliveiros Cristina 2008-09-27 00:38:08 Re: Finding sequential records