Re: JOIN question

Поиск
Список
Период
Сортировка
От Peter Eisentraut
Тема Re: JOIN question
Дата
Msg-id Pine.LNX.4.30.0112222245230.1404-100000@peter.localdomain
обсуждение исходный текст
Ответ на JOIN question  ("Frank Morton" <fmorton@base2inc.com>)
Список 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 по дате отправления:

Предыдущее
От: "Frank Morton"
Дата:
Сообщение: JOIN question
Следующее
От: Ian Barwick
Дата:
Сообщение: Re: JOIN question