Re: selecting rows tagged with "a" but not "b" - Mailing list pgsql-sql

From Andreas Kretschmer
Subject Re: selecting rows tagged with "a" but not "b"
Date
Msg-id 20100201141453.GA8857@tux
Whole thread Raw
In response to selecting rows tagged with "a" but not "b"  (8q5tmkyqry@sneakemail.com)
Responses Re: selecting rows tagged with "a" but not "b"
List pgsql-sql
8q5tmkyqry@sneakemail.com <8q5tmkyqry@sneakemail.com> wrote:

> 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?

select a.* from article left join tags t on a.articleID=t.articleID where b.tag = 'a';



Andreas
-- 
Really, I'm not out to destroy Microsoft. That will just be a completely
unintentional side effect.                              (Linus Torvalds)
"If I was god, I would recompile penguin with --enable-fly."   (unknown)
Kaufbach, Saxony, Germany, Europe.              N 51.05082°, E 13.56889°


pgsql-sql by date:

Previous
From: Andreas Gaab
Date:
Subject: Re: selecting rows tagged with "a" but not "b"
Next
From: Yeb Havinga
Date:
Subject: Re: selecting rows tagged with "a" but not "b"