Re: another simple SQL question

Поиск
Список
Период
Сортировка
От Daniel T. Staal
Тема Re: another simple SQL question
Дата
Msg-id 58669.63.172.115.138.1182786260.squirrel@MageHandbook.com
обсуждение исходный текст
Ответ на another simple SQL question  (Joshua <joshua@joshuaneil.com>)
Список pgsql-novice
On Mon, June 25, 2007 11:28 am, Joshua said:
> Ok here is another simple question from a novice....
>
> Here is what my table looks like
>
> firstname         lastname         fullname
> ----------       ----------       -----------
>                                               smith, john
>                                               green, susan
>                                               white, jeff
>
>
> How can I break the fullname field into firstname lastname fields so it
> looks like the following:
>
> firstname      lastname      fullname
> ---------     ---------       ---------
> john             smith             smith, john
> susan           green             green, susan
> jeff               white             white, jeff
>
> Please let me know. Sorry for such simple novice questions, I appreciate
> your support.

The best way to handle this would actually be to break it _before_ putting
it in to the database.  In fact, you can just have the first and last name
fields then and get the 'fullname' from combining the two.  (Assuming you
don't care about middle names, appliations, or the anything else.)

That's just a comment: I don't know what stage you are in on this database
project.

Assuming you have the database and need to work with it my response to the
above would be to write a perl script to go through and populate the first
and last name fields.  There may be an easier way though.

Daniel T. staal

---------------------------------------------------------------
This email copyright the author.  Unless otherwise noted, you
are expressly allowed to retransmit, quote, or otherwise use
the contents for non-commercial purposes.  This copyright will
expire 5 years after the author's death, or in 30 years,
whichever is longer, unless such a period is in excess of
local copyright law.
---------------------------------------------------------------


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

Предыдущее
От: Joshua
Дата:
Сообщение: another simple SQL question
Следующее
От: Glenn Davy
Дата:
Сообщение: Re: another simple SQL question