Received: from comptechnews.com (root@cc993546-b.srst1.fl.home.com [24.3.77.52]) by hub.org (8.9.3/8.9.3) with ESMTP id PAA15617 for ; Thu, 18 May 2000 15:34:21 -0400 (EDT) (envelope-from reaster@comptechnews.com) Received: from comptechnews (reaster@localhost [127.0.0.1]) by comptechnews.com (8.9.3/8.9.3) with SMTP id PAA10556; Thu, 18 May 2000 15:35:47 -0400 From: "Robert B. Easter" To: "Brian C. Doyle" , pgsql-sql@postgresql.org Subject: Re: Novice Help Needed Date: Thu, 18 May 2000 15:27:56 -0400 X-Mailer: KMail [version 1.0.28] Content-Type: text/plain References: <4.3.1.2.20000518131444.00af6760@pop.mindspring.com> In-Reply-To: <4.3.1.2.20000518131444.00af6760@pop.mindspring.com> MIME-Version: 1.0 Message-Id: <00051815354701.14806@comptechnews> Content-Transfer-Encoding: 8bit X-Archive-Number: 200005/64 On Thu, 18 May 2000, Brian C. Doyle wrote: > Hello, > > I am in need of a rule or trigger that will only allow one entry where the > date and a userid field are the same? > > So on the insert I want it to first check and see if userid and date exist > and if so do not enter them. If they do exist, allow the insert > > Brian C. Doyle If I understand, maybe you can just make a composite primary key out of userid and date. CREATE TABLE atable ( userid INTEGER, thedate TIMESTAMP, PRIMARY KEY (userid, thedate) ); -- Robert B. Easter reaster@comptechnews.com