Re: Join question
От | Bruno Wolff III |
---|---|
Тема | Re: Join question |
Дата | |
Msg-id | 20030530022913.GA5641@wolff.to обсуждение исходный текст |
Ответ на | Join question ("Williams, Travis L, NPONS" <tlw@att.com>) |
Список | pgsql-general |
On Thu, May 29, 2003 at 20:20:35 -0400, "Williams, Travis L, NPONS" <tlw@att.com> wrote: > I have a table that is set up like this > > table A: > First_name,Last_name,login > > I have another table that is set up like this > > table B: > date,date,person1,person2,person3 > > where the person1,2,3 is the login name from the first table. > > I need to get the first_name and last_name of all 3 persons using one select (well I don't have to do it in one.. but Ithought it would be cleaner).. I can do one person using a join select like this: > > select A.First_name,A.Last_name from A,B where B.person1 = A.login > > I tried adding an or statement like "or B.person2 = A.login" but that returns 2 entrys for each row.. where I'm tryingto get all the information back in one. You need to join table A three times and give it three different aliases. One alias gets get checked for each of the three people.
В списке pgsql-general по дате отправления: