Re: - Mailing list pgsql-general

From James Olin Oden
Subject Re:
Date
Msg-id 81Oct18.093330edt.35713@gateway.lee.k12.nc.us
Whole thread Raw
In response to ...  ("Doug Smith" <doug@the-bridge.net>)
List pgsql-general
 Why is that I can only cat two variables in a select statement.ex. select lastname||' '||firstname||' '||address
Delivers an parseing error at "||". When tryingex. select lastnamae||firstnameIt works fine.What's up?

Doug...

 
Hi Doug,

The || operator operates more like a functiion than an operator.  What I mean by that is that, as you have surmised, it takes two and only two arguments.  This does not mean that you cannot concatenate more than two strings...you just need to use parenthesis in the proper way.  Your query would become:

   select ((((lastname||' ')||firstname)||' ')||address

Of course you would need the rest of your query (I assume that was just the half that was giving you trouble).

Hope this helps...james
 
 

pgsql-general by date:

Previous
From: Oleg Broytmann
Date:
Subject: Re: your mail
Next
From: Anton de Wet
Date:
Subject: Re: your mail