Received: from localhost (unknown [200.46.204.182]) by postgresql.org (Postfix) with ESMTP id E0ECC9F9288 for ; Mon, 3 Sep 2007 16:02:31 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.182]) (amavisd-maia, port 10024) with ESMTP id 33333-02 for ; Mon, 3 Sep 2007 16:02:21 -0300 (ADT) X-Greylist: delayed 00:30:35.249928 by SQLgrey-1.7.5 Received: from ns2.instrumentalyst.com (blk-222-55-203.eastlink.ca [24.222.55.203]) by postgresql.org (Postfix) with ESMTP id 968869F975B for ; Mon, 3 Sep 2007 16:02:24 -0300 (ADT) Received: from localhost (localhost [127.0.0.1]) by ns2.instrumentalyst.com (Postfix) with ESMTP id 091901633 for ; Mon, 3 Sep 2007 15:28:08 -0300 (ADT) X-Virus-Scanned: amavisd-new at instrumentalyst.com Received: from ns2.instrumentalyst.com ([127.0.0.1]) by localhost (ns2.instrumentalyst.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id OO5ADr+qQ03K for ; Mon, 3 Sep 2007 15:28:02 -0300 (ADT) Received: from nakul.home (pool-71-180-50-229.tampfl.fios.verizon.net [71.180.50.229]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ns2.instrumentalyst.com (Postfix) with ESMTP id F005814B5 for ; Mon, 3 Sep 2007 15:28:01 -0300 (ADT) Message-ID: <46DC5309.8090604@productivitymedia.com> Date: Mon, 03 Sep 2007 14:31:37 -0400 From: PostgreSQL Admin User-Agent: Thunderbird 2.0.0.6 (Macintosh/20070728) MIME-Version: 1.0 CC: pgsql-sql@postgresql.org Subject: Constraints for grouping References: <865717.50084.qm@web36801.mail.mud.yahoo.com> In-Reply-To: <865717.50084.qm@web36801.mail.mud.yahoo.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=1.337 tagged_above=0 required=5 tests=AWL=-0.596, BAYES_05=-1.11, FH_HOST_ALMOST_IP=1.751, MISSING_HEADERS=1.292 X-Spam-Level: * X-Archive-Number: 200709/9 X-Sequence-Number: 29222 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