Received: from maia.hub.org (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id 542CD635649 for ; Mon, 1 Feb 2010 09:39:19 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 80660-05 for ; Mon, 1 Feb 2010 13:39:08 +0000 (UTC) X-Greylist: delayed 00:07:18.094653 by SQLgrey-1.7.6 Received: from sneak2.sneakemail.com (sneak2.sneakemail.com [38.113.6.65]) by mail.postgresql.org (Postfix) with SMTP id 80AF2635529 for ; Mon, 1 Feb 2010 09:39:08 -0400 (AST) Received: (qmail 28075 invoked from network); 1 Feb 2010 13:31:39 -0000 Received: from unknown (HELO localhost.localdomain) (192.168.0.1) by sneak2.sneakemail.com with SMTP; 1 Feb 2010 13:31:39 -0000 Received: from 38.113.6.61 by mail.sneakemail.com with SMTP; 1 Feb 2010 13:31:39 -0000 Received: (sneakemail censored 11366-1265031099-334353 #1); 1 Feb 2010 13:31:39 -0000 Message-ID: <11366-1265031099-334353@sneakemail.com> From: 8q5tmkyqry@sneakemail.com Date: Mon, 1 Feb 2010 13:31:38 +0000 To: pgsql-sql@postgresql.org Subject: selecting rows tagged with "a" but not "b" MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 X-Mailer: Perl5 Mail::Internet v X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-0.74 tagged_above=-10 required=5 tests=BAYES_20=-0.74 X-Spam-Level: X-Archive-Number: 201002/10 X-Sequence-Number: 33609 Hi, I have a two tables: article articleID, name, content tags articleID, tag I want to find all articles that are tagged with "a" but not "b" how do I do this? what I'd like to do is: select articleID from tags where tag="a" SUBTRACT select articleID from tags where tab="b" how do I do this in real SQL? thanks Darrell