Thread: Easy SQL Question
I Was looking at the PgSQL documentation last night but could not find how to join two fields as one, i.e select (firstname + lastname) as fullname from users I also tried (Cast(firstname as varchar) + Cast(lastname as varchar)) But that doesn't work.. How do I do this? Thanks
You can do it like this:
select firstname || ' ' || lastname as fullname from emp;
/Shoaib
select firstname || ' ' || lastname as fullname from emp;
/Shoaib
On 6/12/06, Greg < greg@officium.co.za> wrote:
I Was looking at the PgSQL documentation last night but could not find how
to join two fields as one,
i.e
select (firstname + lastname) as fullname from users
I also tried (Cast(firstname as varchar) + Cast(lastname as varchar))
But that doesn't work..
How do I do this?
Thanks
---------------------------(end of broadcast)---------------------------
TIP 5: don't forget to increase your free space map settings
Hi, On Mon, 2006-06-12 at 10:58 +0200, Greg wrote: > I Was looking at the PgSQL documentation last night but could not find > how to join two fields as one, Use || for concat. -- The PostgreSQL Company - Command Prompt, Inc. 1.503.667.4564 PostgreSQL Replication, Consulting, Custom Development, 24x7 support Managed Services, Shared and Dedicated Hosting Co-Authors: plPHP, plPerlNG - http://www.commandprompt.com/