Re: Constraints for grouping

From: Richard Broersma Jr <rabroersma(at)yahoo(dot)com>
To: Richard Broersma Jr <rabroersma(at)yahoo(dot)com>, PostgreSQL Admin <postgres(at)productivitymedia(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Constraints for grouping
Date: 2007-09-03 20:40:06
Message-ID: 917951.78388.qm@web31814.mail.mud.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

OOPS!
--- Richard Broersma Jr <rabroersma(at)yahoo(dot)com> wrote:
> CREATE UNIQUE INDEX Only_one_row_true
> ON Your_table ( featured )
> WHERE featured = true;
>
> Or if you want to only allow 1 featured article per catagory then:
>
> CREATE UNIQUE INDEX Only_one_row_true_per_catagory
> ON Your_table ( catigories, featured )
> WHERE featured = true;

I forgot the unique part of the DDL.

Regards,
Richard Broersma Jr.

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message chester c young 2007-09-03 21:59:11 Re: Execute SQL statements with 'context'/predefined variables
Previous Message Richard Broersma Jr 2007-09-03 20:35:07 Re: Constraints for grouping