pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: PostgreSQL Admin <postgres@productivitymedia.com>
Cc: pgsql-sql@postgresql.org
Subject: Constraints for grouping
Date: Mon, 03 Sep 2007 14:31:37 -0400
Message-ID: <46DC5309.8090604@productivitymedia.com> (raw)
In-Reply-To: <865717.50084.qm@web36801.mail.mud.yahoo.com>
References: <865717.50084.qm@web36801.mail.mud.yahoo.com>

I have a question that I've thought in my head about using triggers, but
I figure to ask people that do SQL more than I.  So, I have a table that
I want two columns.

(1) A featured column which is for only 1 row, once it switched to
another row than all other rows must be false

             title              | author_id | categories | featured
--------------------------------+-----------+------+-----
 Thierry Beta Release           |         3 |         11 | True
 Different Approach  |         3 |         11 |
 Ottawa Does Not Heart Hip-Hop  |         3 |         11 |

(2) A featured column by category and only allow category_feature equal
to the number of categories.

Is SQL the way to go (and how - ideas), or should I use python for the
heavy lifting?

Thanks for any input,
J



view thread (4+ messages)  latest in thread

Message-ID: <46DC5309.8090604@productivitymedia.com>
Permalink:  ../46DC5309.8090604@productivitymedia.com/
Also on:    postgresql.org/message-id/46DC5309.8090604@productivitymedia.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: postgres@productivitymedia.com
  Subject: Re: Constraints for grouping
  In-Reply-To: <46DC5309.8090604@productivitymedia.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox