Re: [GENERAL] combining contents of two fields into a new field?
От | Jeff Hoffmann |
---|---|
Тема | Re: [GENERAL] combining contents of two fields into a new field? |
Дата | |
Msg-id | 36D1A481.B1706BF9@remapcorp.com обсуждение исходный текст |
Ответ на | combining contents of two fields into a new field? ("William J. Stotts" <wstotts@sonitrol.net>) |
Список | pgsql-general |
"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? > if the fields are character data, you'd want to use the concatenate operator "||". the last i checked, you can't string a bunch of fields together, so more than two fields is a PITA (you have to use a bunch of parentheses to group things together). there was talk of changing this, but i forget what happened to it. for example a phone number might be something like this: update my_data set new_phone = (('(' || area_code) || ') ') || ((prefix || '-') || number); (i hope i got the parentheses right, and i hope this helps.) jeff
В списке pgsql-general по дате отправления: