Re: string concatenation?

From: Jose Soares <jose(at)sferacarta(dot)com>
To: epikkara(at)ktk(dot)oulu(dot)fi
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: string concatenation?
Date: 2001-01-08 13:36:39
Message-ID: 3A59C266.F2FE03B2@sferacarta.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Esa Pikkarainen wrote:

> I could not find explicite answer in docs and before massive testing
> I would like to as is this at all possible:
>
> I want to get string value which is a comma separated combination of
> two integers. I want to get these both values from one subquery. In
> Access I could do it this way:
>
> SELECT other-fields,
> (SELECT [value1] & ',' & [value2] AS value1-2
> FROM this-table WHERE id = 1)
> as value1-2
> FROM other-tables
> ;
>

PostgreSQL uses the vertical bar '|' to concatenate strings this is
Standard SQL.

SELECT other-fields,
(SELECT value1 | ',' | value2
FROM this-table WHERE id = 1
) as value12
FROM other-tables;

>
> If value1 = 1 and value2 = 2 then the query result of value1-2 = 1,2
>
> If I remember right there was some "concat" function in Mysql. Access
> uses "&" from Visual Basic. I don't think it will work with
> Postgresql.
>
> Thanks
> Esa Pikkarainen

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Gordan Bobic 2001-01-08 13:38:57 Re: Version 7.1 when??
Previous Message Esa Pikkarainen 2001-01-08 13:27:48 Re: string concatenation?