Re: Finding sequential records - Mailing list pgsql-sql

From Richard Broersma
Subject Re: Finding sequential records
Date
Msg-id 396486430809261212o61b9bbbdhf444ab0b23036fb@mail.gmail.com
Whole thread Raw
In response to Re: Finding sequential records  ("Richard Broersma" <richard.broersma@gmail.com>)
List 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


pgsql-sql by date:

Previous
From: Lennin Caro
Date:
Subject: Re: Problem with pg_connect() in PHP
Next
From: Steve Midgley
Date:
Subject: Re: Finding sequential records