From: | Derrick Betts <list(at)blueaxis(dot)com> |
---|---|
To: | Joshua <joshua(at)joshuaneil(dot)com> |
Cc: | pgsql-novice(at)postgresql(dot)org |
Subject: | Re: another simple SQL question |
Date: | 2007-06-25 16:04:20 |
Message-ID: | 467FE784.3060606@blueaxis.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general pgsql-novice pgsql-sql |
Try this:
SELECT substr(fullname, 1, position(',' IN fullname)-1) AS first,
trim(substr(fullname, position(',' IN fullname)+1, length(fullname)))
AS last
FROM table_name;
Joshua wrote:
> 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.
>
> THANKS!
>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: explain analyze is your friend
>
>
>
From | Date | Subject | |
---|---|---|---|
Next Message | Glenn Davy | 2007-06-25 16:14:42 | Re: another simple SQL question |
Previous Message | Glenn Davy | 2007-06-25 16:02:46 | Re: another simple SQL question |
From | Date | Subject | |
---|---|---|---|
Next Message | Glenn Davy | 2007-06-25 16:14:42 | Re: another simple SQL question |
Previous Message | Glenn Davy | 2007-06-25 16:02:46 | Re: another simple SQL question |
From | Date | Subject | |
---|---|---|---|
Next Message | Glenn Davy | 2007-06-25 16:14:42 | Re: another simple SQL question |
Previous Message | Glenn Davy | 2007-06-25 16:02:46 | Re: another simple SQL question |