From: | Leslie Mikesell <les(at)Mcs(dot)Net> |
---|---|
To: | joden(at)lee(dot)k12(dot)nc(dot)us (James Olin Oden) |
Cc: | pgsql-sql(at)postgreSQL(dot)org |
Subject: | Re: [SQL] Concatenation in selects |
Date: | 1998-09-03 19:33:12 |
Message-ID: | 199809031933.OAA19204@Jupiter.Mcs.Net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
According to James Olin Oden:
>
> > I know it can be done, but I cannot seem to figure out how to output to
> > fields concatenated together in a select. For instance, I have a table
> > with first_name and last_name as fields (among others). I would like
> > display first_name and last_name as one field. I want to do something
> > like:
> >
> > name=first_name + " " + last_name
> >
> > but of course within an SQL select statement. Thanks...james
>
> Sorry, I finally found it in the hackers mailing list. The answer is:
>
> select textcat(textcat(first_name, ' '),last_name) from users;
>
> I just couldn't seem to find that documented, I am sure it is though.
> Thanks...james
You should also be able to use the SQL concatenation operator '||'. It
doesn't seem to be able to understand more than 2 things at once so
you have to use parens for grouping. I don't know if that is an SQL
requirement or a postgresql limitation.
select (first_name || ' ') || last_name as full_name from users;
Les Mikesell
les(at)mcs(dot)com
From | Date | Subject | |
---|---|---|---|
Next Message | Bruce Momjian | 1998-09-04 01:04:32 | Re: [SQL] Concatenation in selects |
Previous Message | Jackson, DeJuan | 1998-09-03 18:45:54 | RE: Resp: [SQL] Concatenation in selects |