From: Henry Lafleur <HLafleur@phoenixforge.com>
To: Sandis <sandis@mediaparks.lv>
To: pgsql-sql@postgresql.org
Subject: RE: Simple concatenation in select query
Date: Mon, 31 Jul 2000 17:05:24 -0400
Message-ID: <E332B20358CDD1118D7A00A0C995F75A914675@XSERVER> (raw)
PostgreSQL has a string concatenation operator (see operators in the
manual):
SELECT last_name||', '||first_name FROM ...
Here's a ref: http://www.postgresql.org/docs/user/x2129.htm
Henry
-----Original Message-----
From: Sandis [mailto:sandis@mediaparks.lv]
Sent: Monday, July 31, 2000 2:48 PM
To: pgsql-sql@postgresql.org
Subject: [SQL] Simple concatenation in select query
Hello,
Sorry for the stupid posting, but..
There was a string concatenation function in MySQL:
SELECT CONCAT(first_name, " ", last_name) FROM table;
Is there a similar function in Postgres?
Certainly, it's possible to live without it, but i'd like to write as above,
doing concatenation in place.
Ok, it seems i found it now:
SELECT TEXTCAT(first_name, last_name) FROM table;
but it allows only 2 arguments, inserting " " or ' ' (space) causes
an error: attribute ' ' not found! Why postgres doesnt see it as string?
Ok, i got it, after all! It took > 30 min to write this query. :(
SELECT textcat(textcat(first_name,text ' '),last_name) from table;
It kind of strange, but i found this function not in "user manual",
but doing "\df text".. There is some differences between function
descriptions in manual and those that \df returns..
Virtually \df returns much more functions than in manual,
and there is some differences in argument types.
May be someone knows a better, complete manual with ALL
function described and code samples?
sandis@mediaparks.lv
www.mediaparks.lv
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: HLafleur@phoenixforge.com, sandis@mediaparks.lv
Subject: RE: Simple concatenation in select query
In-Reply-To: <E332B20358CDD1118D7A00A0C995F75A914675@XSERVER>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox