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

From Joel Burton
Subject Re: What err ???
Date
Msg-id Pine.LNX.4.30.0206070942220.26454-100000@temp.joelburton.com
Whole thread Raw
In response to What err ???  ("Robson Martins" <robson-martins@bol.com.br>)
List pgsql-admin
On Thu, 6 Jun 2002, Robson Martins wrote:

> What err ???
>
> SELECT RazaoSocial + ' - ' + Iif(Bairro Is Null,'',Bairro + ' ') + CGCCli As Coluna FROM Clientes WHERE RazaoSocial
Like'%A%' 

Messages like this are better sent to pgsql-general or pgsql-sql, by the
way.

Two problems:

. Strings are concatenated using ||, not +. 'Cat' || 'Dog' => 'CatDog',
whereas 'Cat' + 'Dog' => ASCII result of this (not what you want)

. IIf() is a nonstandard Microsoft function used in Access. SQL databases
use CASE. See the docs for examples on CASE.

- J.
--

Joel BURTON  |  joel@joelburton.com  |  joelburton.com  |  aim: wjoelburton
Independent Knowledge Management Consultant


pgsql-admin by date:

Previous
From: "Joshua b. Jore"
Date:
Subject: Re: [GENERAL] performance issue using DBI
Next
From: "Ross J. Reedstrom"
Date:
Subject: Re: What err ???