Re: [GENERAL] JOIN exclusion problem

Поиск
Список
Период
Сортировка
От Chris Bitmead
Тема Re: [GENERAL] JOIN exclusion problem
Дата
Msg-id 377B0956.78E69E3A@ozemail.com.au
обсуждение исходный текст
Ответ на JOIN exclusion problem  (Anja Speerforck <anja@damn.com>)
Ответы Re: [GENERAL] JOIN exclusion problem  (Anja Speerforck <anja@damn.com>)
Список pgsql-general
Try using AND instead of OR.

Anja Speerforck wrote:
>
> Hello,
>
> I'm trying to join three tables, where I need only one piece of data from
> two of the tables.  The code I wrote is:
>
> SELECT apartner_nr, ap.anrede, ap.vorname, ap.nachname, ap.telefon, ap.fax,
> ap.email, ap.kunden_nr, k.name1, ap.agentur_nr, ag.name1
> FROM ansprechpartner ap, kunden k, agenturen ag
> WHERE ap.kunden_nr = k.kunden_nr OR ap.agentur_nr = ag.agentur_nr
> ORDER BY nachname"
>
> The problem is that each row from each table is combined with each row of
> the other tables.  I know the code is wrong, but I don't know how to write
> it so that the results show only the actual value of ag.name1 and k.name1,
> and not all of the possible combinations.
>
> Is there a way of limiting how the rows are built up?  Pardon for novice
> nature of this question...
>
> Thanks in advance,
>
> Anja

В списке pgsql-general по дате отправления:

Предыдущее
От: Bruce Momjian
Дата:
Сообщение: Re: [GENERAL] urgent: problems with query_limit
Следующее
От: Anja Speerforck
Дата:
Сообщение: Re: [GENERAL] JOIN exclusion problem