Re: [NOVICE] Trouble with IN operator - Mailing list pgsql-novice

From Chuck Roberts
Subject Re: [NOVICE] Trouble with IN operator
Date
Msg-id CAByBP0rG0LGupes3xLqFDM-W9Z=sBuayDy_2shqe-Kj06f_Png@mail.gmail.com
Whole thread Raw
In response to Re: [NOVICE] Trouble with IN operator  ("David G. Johnston" <david.g.johnston@gmail.com>)
Responses Re: [NOVICE] Trouble with IN operator
List pgsql-novice
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


On Fri, Feb 3, 2017 at 12:37 PM, David G. Johnston <david.g.johnston@gmail.com> wrote:
On Fri, Feb 3, 2017 at 10:12 AM, Chuck Roberts <croberts@gilsongraphics.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.



pgsql-novice by date:

Previous
From: "David G. Johnston"
Date:
Subject: Re: [NOVICE] Trouble with IN operator
Next
From: Chris Campbell
Date:
Subject: Re: [NOVICE] Trouble with IN operator