On Thu, Sep 1, 2016 at 4:28 AM, Michelle Konzack <linux4michelle@xxxxxxxxx> wrote: > 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. Just to be clear, you probably have a customer table with "CustIomerId" as its key and are talking about a "child"of that where you want a 2-column key? > 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? If, for example, the child table is a list of customer contacts, you might add a "LastContactNo" column to the customer table, defaulting to zero on customer insert, and which you increment to get values for the second key column in the contact table. -- Kevin Grittner EDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company -- Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general