Re: How to format strings

Поиск
Список
Период
Сортировка
От Warren Vanichuk
Тема Re: How to format strings
Дата
Msg-id Pine.LNX.4.21.0011082151430.12417-100000@urd.street-light.com
обсуждение исходный текст
Ответ на How to format strings  (Ian Willis <Ian.Willis@ento.csiro.au>)
Список pgsql-general
> Some time ago I saw the someone give an example of how to combine a
> query result with test using sql.
> What i have is a table with f_name varchar l_name varchar and I want the
> result to say f_name.l_name@mydomain.com
> Is this possible I will redirect the output to a textfile using the \o
> option.

The only way I could come up with to do this is :

test=> \d test
Table    = test
+----------------------------------+----------------------------------+-------+
|              Field               |              Type                | Length|
+----------------------------------+----------------------------------+-------+
| text1                            | varchar()                        |   255 |
| text2                            | varchar()                        |   255 |
+----------------------------------+----------------------------------+-------+

test=> select textcat( textcat( textcat( text1, '.' ), text2 ), '@domain.com' ) as result from test;
result
------------------
foo.bar@domain.com
bar.vaz@domain.com
bar.foo@domain.com
(3 rows)

Perhaps somebody has a better way? :)

Hope this helps! :)

Sincerely, Warren


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

Предыдущее
От: Ian Willis
Дата:
Сообщение: How to format strings
Следующее
От: Charles Curley
Дата:
Сообщение: Re: [NOVICE] Re: VACUUM AND VACUUM ANALYSE