Re: JOIN question

From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: Frank Morton <fmorton(at)base2inc(dot)com>
Cc: <pgsql-sql(at)postgresql(dot)org>
Subject: Re: JOIN question
Date: 2001-12-22 23:27:07
Message-ID: Pine.LNX.4.30.0112222245230.1404-100000@peter.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Frank Morton writes:

> If I do the query:
>
> select Content.* from Content,Protection
> where (Content.id = Protection.contentId);
>
> I get three rows back, corresponding to each group that has
> access to the content. However, I would like to get back
> just one row, corresponding to the content that fits the desired
> protections.

You didn't specify the "desired protection" anywhere within your query.

Possibly you want something like

SELECT * FROM content, protection WHERE content.id = protection.contentid
AND protection.name = 'something';

This will give you the content that "something" has access to, which may
be zero, one, or many rows.

--
Peter Eisentraut peter_e(at)gmx(dot)net

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Andrew G. Hammond 2001-12-23 16:03:45 Re: [SQL] HELP PLEASE: Error executing the example esql.xml on
Previous Message Ian Barwick 2001-12-22 22:57:34 Re: JOIN question