Received: from Kitten.mcs.com (Kitten.mcs.com [192.160.127.90]) by hub.org (8.8.8/8.7.5) with ESMTP id PAA24148 for ; Thu, 3 Sep 1998 15:33:16 -0400 (EDT) Received: from Jupiter.Mcs.Net (les@Jupiter.mcs.net [192.160.127.88]) by Kitten.mcs.com (8.8.7/8.8.2) with ESMTP id OAA08665; Thu, 3 Sep 1998 14:33:13 -0500 (CDT) Received: (from les@localhost) by Jupiter.Mcs.Net (8.8.7/8.8.2) id OAA19204; Thu, 3 Sep 1998 14:33:13 -0500 (CDT) From: Leslie Mikesell Message-Id: <199809031933.OAA19204@Jupiter.Mcs.Net> Subject: Re: [SQL] Concatenation in selects To: joden@lee.k12.nc.us (James Olin Oden) Date: Thu, 3 Sep 1998 14:33:12 -0500 (CDT) Cc: pgsql-sql@postgreSQL.org In-Reply-To: <81Sep2.090702edt.35713@gateway.lee.k12.nc.us> from "James Olin Oden" at Sep 3, 98 10:16:33 am X-Mailer: ELM [version 2.4 PL24] Content-Type: text 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@mcs.com