Received: from maia.hub.org (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id 8C4A8635529 for ; Mon, 1 Feb 2010 10:00:24 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.208.211]) (amavisd-maia, port 10024) with ESMTP id 84662-10 for ; Mon, 1 Feb 2010 14:00:05 +0000 (UTC) X-Greylist: delayed 00:15:12.030986 by SQLgrey-1.7.6 Received: from jupiter.marktest.pt (delta.marktest.pt [80.251.174.116]) by mail.postgresql.org (Postfix) with ESMTP id 8150563544E for ; Mon, 1 Feb 2010 10:00:13 -0400 (AST) Received: from Proteu (proteu.marktest.pt [10.61.90.54]) by jupiter.marktest.pt with SMTP (Microsoft Exchange Internet Mail Service Version 5.5.2653.13) id Z83S516W; Mon, 1 Feb 2010 13:44:57 -0000 Message-ID: From: "Oliveiros C," To: <8q5tmkyqry@sneakemail.com>, References: <11366-1265031099-334353@sneakemail.com> Subject: Re: selecting rows tagged with "a" but not "b" Date: Mon, 1 Feb 2010 13:44:57 -0000 MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset="utf-8"; reply-type=original Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2900.5512 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5579 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-0.141 tagged_above=-10 required=5 tests=AWL=-0.143, BAYES_50=0.001, STOX_REPLY_TYPE=0.001 X-Spam-Level: X-Archive-Number: 201002/12 X-Sequence-Number: 33611 Darrell, Can you provide a little more information and background on your problem. please? What values can the "tag" column assume? Just "a" and "b" ? Both? Please give examples of table contents and desired output, your mail doesn't contain enough info to give you more advises Thank you Best, Oliveiros ----- Original Message ----- From: <8q5tmkyqry@sneakemail.com> To: Sent: Monday, February 01, 2010 1:31 PM Subject: [SQL] selecting rows tagged with "a" but not "b" > 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 > > -- > Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) > To make changes to your subscription: > http://www.postgresql.org/mailpref/pgsql-sql