Re: Removing simliar elements from a set

From: "Dan Langille" <dan(at)langille(dot)org>
To: Josh Berkus <josh(at)agliodbs(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Removing simliar elements from a set
Date: 2003-09-27 12:38:27
Message-ID: 3F754C83.22347.29465C5B@localhost
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On 26 Sep 2003 at 16:55, Josh Berkus wrote:

> Dan,
>
> > I'm trying to remove items from a set which are similar to items in
> > another set.
> <snip>
>
> > In short, we remove all items from MASTER which are under the directories
> > specified in MATCHES.
>
> from your example, you are trying to remove all directories which do *not*
> match. What do you want, exactly?

Josh and I talked on IRC about this.

This is the result set I want:

/ports/Mk/bsd.python.mk

I want things from MASTER which do not match things in MATCHES.

Josh suggested this:

SELECT *
FROM master
WHERE NOT EXISTS (
SELECT *
FROM matches
WHERE master.pathname LIKE (matches.pathname || '/%'));

Cheers.
--
Dan Langille : http://www.langille.org/

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message shengqj 2003-09-27 12:47:29 help
Previous Message Josh Berkus 2003-09-26 23:55:13 Re: Removing simliar elements from a set