Re: Trouble with IN operator

From: Chuck Roberts <croberts(at)gilsongraphics(dot)com>
To: Chris Campbell <ccampbell(at)cascadeds(dot)com>
Cc: PSql novice list <pgsql-novice(at)postgresql(dot)org>
Subject: Re: Trouble with IN operator
Date: 2017-02-03 18:29:27
Message-ID: CAByBP0r+6a90o7DAuFXcN1d0GW+5kLKCeWwW6WK9a5JLBxbLPw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

I think this might be a data problem. If anyone else has an idea, it's
welcome.

Thanks!

Chuck Roberts
Gilson Graphics | Composition Dept.
p:616-459-4539 x 1228

On Fri, Feb 3, 2017 at 1:14 PM, Chris Campbell <ccampbell(at)cascadeds(dot)com>
wrote:

> Empty String or Null?
>
>
>
> Try: trim(Coalesce(tbl.costcenter,’’)) IN …
>
>
>
>
>
> Chris Campbell | Software Architect
>
> C A S C A D E D A T A S O L U T I O N S
>
> (800) 280-2090
>
> www.cascadeds.com
>
>
>
> *From:* pgsql-novice-owner(at)postgresql(dot)org [mailto:pgsql-novice-owner@
> postgresql.org] *On Behalf Of *Chuck Roberts
> *Sent:* Friday, February 3, 2017 10:08 AM
> *To:* PSql novice list <pgsql-novice(at)postgresql(dot)org>
> *Subject:* Re: [NOVICE] Trouble with IN operator
>
>
>
> This is a vendor's database and we don't have control over it, nor do we
> have direct access to the Postgresql table layouts. We are given a
> spreadsheet to show us what the data types are.
>
>
>
> As for the data, sometimes tbl.costcenter can be blank on some records.
> Surely that wouldn't interfere with the IN operator?
>
>
>
> Chuck
>
>
>
>
> Thanks!
>
>
>
> Chuck Roberts
>
> Gilson Graphics | Composition Dept.
>
> p:616-459-4539 x 1228 <(616)%20459-4539>
>
>
>
> On Fri, Feb 3, 2017 at 12:37 PM, David G. Johnston <
> david(dot)g(dot)johnston(at)gmail(dot)com> wrote:
>
> On Fri, Feb 3, 2017 at 10:12 AM, Chuck Roberts <
> croberts(at)gilsongraphics(dot)com> wrote:
>
>
>
> AND (TRIM(tbl.costcenter) IN ('540'))
>
>
>
> Can anyone shed some light on this for me?
>
>
>
>
>
> ​It works...
>
>
>
> ​WITH tbl (id, costcenter) AS ( VALUES (1, '500'), (2, '550') )
>
> SELECT *
>
> FROM tbl
>
> WHERE (trim(tbl.costcenter) IN ('550'));
>
>
>
> So the problem resides in something you haven't show us - namely data.
>
>
>
> David J.
>
>
>
>
>
>
>

In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Tom Lane 2017-02-03 18:40:58 Re: Trouble with IN operator
Previous Message Chris Campbell 2017-02-03 18:14:47 Re: Trouble with IN operator