Re: Question About UNION

Поиск
Список
Период
Сортировка
От Bill Thoen
Тема Re: Question About UNION
Дата
Msg-id 48EE3D3C.4020501@gisnet.com
обсуждение исходный текст
Ответ на Re: Question About UNION  (Raymond O'Donnell <rod@iol.ie>)
Список pgsql-general
Raymond O'Donnell wrote:
> On 09/10/2008 17:59, Bill Thoen wrote:
>
>>>> I'm trying to combine two tables, but I only want unique records based
>>>> on the first two columns. Can UNION be used to join three-column tables
>>>> but only include records based on the uniqueness of the first two
>>>> columns? If not, how would I do this with PostgreSQL 8.1?
>>>>
>>>>
>>> How do you decide which records you want? - e.g. given the following
>>> rows...
>>>
>>>   (a, b, c)
>>>   (a, b, d)
>>>
>>> ...how do you decide whether you the one with c or the one with d?
>>>
>>>
>>>
>> The physical order that they appear will take care of that.
>>
>
> Hmmmm....
>
> Leaving that aside, how about SELECTing the columns you want to be
> unique from the two tables, and then JOINing the UNION of those back
> with the UNION of the complete (three-column) tables?
>
Say, that just might work! I'll give it a try. Thanks!

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

Предыдущее
От: Raymond O'Donnell
Дата:
Сообщение: Re: Question About UNION
Следующее
От: Bill Thoen
Дата:
Сообщение: Re: Question About UNION