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
Subject: Re: Finding sequential records
Date: 2008-09-26 19:12:35
Message-ID: 396486430809261212o61b9bbbdhf444ab0b23036fb@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

oops I noticed I forgot the having clause:

> SELECT id
> FROM Dummy
> GROUP BY name, fkey_id
Having count(*) > 1;

> SELECT A.*
> FROM ( SELECT ID
> FROM Dummy
> GROUP BY name, fkey_id
HAVING count(*) > 1 ) AS A
> INNER JOIN Dummy AS D
> ON A.id - 1 = D.id
> OR A.id + 1 = D.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-26 22:25:59 Re: Finding sequential records
Previous Message Lennin Caro 2008-09-26 18:47:02 Re: Problem with pg_connect() in PHP