Re: JOIN question - Mailing list pgsql-sql

From Peter Eisentraut
Subject Re: JOIN question
Date
Msg-id Pine.LNX.4.30.0112222245230.1404-100000@peter.localdomain
Whole thread Raw
In response to JOIN question  ("Frank Morton" <fmorton@base2inc.com>)
List 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@gmx.net



pgsql-sql by date:

Previous
From: "Frank Morton"
Date:
Subject: JOIN question
Next
From: Ian Barwick
Date:
Subject: Re: JOIN question