Re: Adding PRIMARY KEY: Table contains duplicated values

From: Alexander Farber <alexander(dot)farber(at)gmail(dot)com>
To: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: Adding PRIMARY KEY: Table contains duplicated values
Date: 2013-02-04 14:45:40
Message-ID: CAADeyWhBjv9BL97ZHMf_nzm2x3NytXi_qyNnykOFZ14KHT3nRQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Trying to delete the older of the duplicated pairs:

# SELECT id, author, count(1), max(stamp) as maxx
FROM pref_rep
GROUP BY id, author
HAVING count(1) >1 and stamp < maxx;
ERROR: column "maxx" does not exist
LINE 4: HAVING count(1) >1 and stamp < maxx;
^

On Mon, Feb 4, 2013 at 3:36 PM, Alexander Farber
<alexander(dot)farber(at)gmail(dot)com> wrote:
>>> http://stackoverflow.com/questions/14688523/adding-primary-key-table-contains-duplicated-values
>

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Kirk Wythers 2013-02-04 14:46:22 partial time stamp query
Previous Message Kirk Wythers 2013-02-04 14:45:33 partial time stamp query