Re: What err ??? - Mailing list pgsql-admin

From Ross J. Reedstrom
Subject Re: What err ???
Date
Msg-id 20020607143707.GA7155@rice.edu
Whole thread Raw
In response to What err ???  ("Robson Martins" <robson-martins@bol.com.br>)
Responses Re: What err ???  (Tim Ellis <Tim.Ellis@gamet.com>)
List pgsql-admin
On Thu, Jun 06, 2002 at 05:43:28PM -0300, Robson Martins wrote:
> What err ???
>
> SELECT RazaoSocial + ' - ' + Iif(Bairro Is Null,'',Bairro + ' ') + CGCCli As Coluna FROM Clientes WHERE RazaoSocial
Like'%A%' 

This looks like some other dialect of SQL, not SQL92 (nor PostGreSQL).

I _think_ you want something like:

SELECT RazaoSocial || ' - ' || COALESCE(Bairro || ' ', '') || CGCCli As
Coluna FROM Clientes WHERE RazaoSocial Like '%A%';

The differences are that the text concatenation operator is '||', not '+',
and COALESCE(), which returns it's first non-NULL parameter.

Note that this is _not_ an ADMIN question: it belongs on NOVICE.

Ross
--
Ross Reedstrom, Ph.D.                                 reedstrm@rice.edu
Executive Director                                  phone: 713-348-6166
Gulf Coast Consortium for Bioinformatics              fax: 713-348-6182
Rice University MS-39
Houston, TX 77005

pgsql-admin by date:

Previous
From: Joel Burton
Date:
Subject: Re: What err ???
Next
From: Masaru Sugawara
Date:
Subject: Re: What err ???