Re: [GENERAL] combining contents of two fields into a new field?

Поиск
Список
Период
Сортировка
От Ross J. Reedstrom
Тема Re: [GENERAL] combining contents of two fields into a new field?
Дата
Msg-id 36D1A0AD.5B29F7D5@rice.edu
обсуждение исходный текст
Ответ на combining contents of two fields into a new field?  ("William J. Stotts" <wstotts@sonitrol.net>)
Список pgsql-general
With the || concationation operator, as so:

UPDATE dice_data SET dice_new_phone = dice_prefix || dice_phone

Note, however, that for some reason you must add axplicit parens for
multiple concats:

UPDATE dice_data SET dice_new_phone = dice_prefix || dice_phone ||
dice_suffix

won't work (yet!), but:

UPDATE dice_data SET dice_new_phone = (dice_prefix || dice_phone)||
dice_suffix

should.

William J. Stotts wrote:
>
> Hi folks,
>
> Please excuse this question for it shows my ignorance;-)
>
> I need to combine the contents of three different fields into a single
> field. I understand how to perform an update on a field with the contents
> of another field via a query like:
>  UPDATE dice_data SET dice_new_phone = dice_prefix
>
> I need to update this field with a concatenation of three fields actually.
> What I am ignorant of is how to perform such an update. WOuld someone
> kindly guide me in how to perform such an update?
>
> Thanks in advance8-)
>
> Bill Stotts
>
> ps-please reply to me directly as well as the mailing list.
>
> **************************************************************************
> Bill Stotts                          |  Voice: 860-616-7535
> wstotts@sonitrol.net                 |    Fax: 860-616-7589
> Sonitrol Communications Corp.        |
>                                      |
> _SONITROL_ Expect the best...        |  Where do you want to GO tomorrow?
> **************************************************************************

--
Ross J. Reedstrom, Ph.D., <reedstrm@rice.edu>
NSBRI Research Scientist/Programmer
Computer and Information Technology Institute
Rice University, 6100 S. Main St.,  Houston, TX 77005

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

Предыдущее
От: Julian Scarfe
Дата:
Сообщение: Re: [GENERAL] GIS/GPS Experiences with pgsql?
Следующее
От: Michael Davis
Дата:
Сообщение: Transaction logging