Re: What is || doing - Mailing list pgsql-novice

From Thom Brown
Subject Re: What is || doing
Date
Msg-id BANLkTiksAZGbx5_11_aNEKz6H_gjyZBVpw@mail.gmail.com
Whole thread Raw
In response to What is || doing  (Frank Lanitz <frank@frank.uvena.de>)
List pgsql-novice
On 27 June 2011 13:59, Frank Lanitz <frank@frank.uvena.de> wrote:
> Hi list,
>
> I've got an query which contains || inside the select statement and I'm
> not sure, what this is doing. Can you help me out a bit or send me a
> link to documentation where I can find this?
>
> Example:
>
> SELECT 'ba_'|| foo || '_pr_'
> FROM 'foobaa'
> WHERE id=1234;

|| in PostgreSQL is a concatenation operator.  It's equivalent to + in
Microsoft SQL Server, or concat() in MySQL.

So if foo = 'hello', the output of that select would be 'ba_hello_pr_'

See http://www.postgresql.org/docs/current/static/functions-string.html

Regards

Thom Brown
Twitter: @darkixion
IRC (freenode): dark_ixion
Registered Linux user: #516935

EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

pgsql-novice by date:

Previous
From: Frank Lanitz
Date:
Subject: What is || doing
Next
From: "Jean-Yves F. Barbier"
Date:
Subject: Re: What is || doing