Re: Add one column to another

Поиск
Список
Период
Сортировка
Искать
От
Tim Landscheidt
Тема
Re: Add one column to another
Дата
Msg-id
m3vctlqt2h.fsf@passepartout.tim-landscheidt.de
Список
Дерево обсуждения
Re: Add one column to another Tim Landscheidt <tim@tim-landscheidt.de>
(anonymous) wrote:

> I have to deal with a table which contains:

> first_name
> surname
> email1
> email2

> ... and I would like to create a view which combines both email columns thus:

> first_name
> surname
> email

> It looks simple but I can't think of an obvious query.

Try:

| SELECT first_name, surname, email1 AS email FROM testtable WHERE email1 IS NOT NULL UNION ALL
| SELECT first_name, surname, email2 AS email FROM testtable WHERE email2 IS NOT NULL;

Tim


В списке pgsql-sql по дате отправления
От: David Johnston
Дата:
Сообщение: Re: Add one column to another
От: Scott Marlowe
Дата:
Сообщение: Re: Add one column to another
FAQ