Re: COL unique (CustomerID) plus COL unique (COUNT) inside CustomerID

From: Andreas Kretschmer <akretschmer(at)spamfence(dot)net>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: COL unique (CustomerID) plus COL unique (COUNT) inside CustomerID
Date: 2016-09-01 14:01:22
Message-ID: 20160901140122.GA9569@tux
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Michelle Konzack <linux4michelle(at)gmail(dot)com> wrote:

> Hello to all,
>
> after a period of silence from Debian, Courier, PHP and PostgreSQL I am
> half back and running into a problem... :-/
>
> I need a table with an UNIQUE CustomerID which is working fine...
>
> ...BUT I need also a second column with a count, which must be UNIQUE
> inside the CustomerID.
>
> In clear this:
>
> CustID Count
> 1 1
> 1 2
> 1 3
>
> 2 1
> 2 2
>
> 3 1
> 3 2
> 3 3
> ...
>
> How to do this?

don't store the Count-column and using row_number() over (partition by
CustId) instead?

Btw.: Greetings, how are you? ;-)

Regards, Andreas Kretschmer
--
Andreas Kretschmer
http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

In response to

Browse pgsql-general by date

  From Date Subject
Next Message dandl 2016-09-01 14:37:37 Re: UPDATE OR REPLACE?
Previous Message rob stone 2016-09-01 13:35:17 Re: COL unique (CustomerID) plus COL unique (COUNT) inside CustomerID