From: | Chuck Roberts <croberts(at)gilsongraphics(dot)com> |
---|---|
To: | PSql novice list <pgsql-novice(at)postgresql(dot)org> |
Subject: | Trouble with IN operator |
Date: | 2017-02-03 17:12:29 |
Message-ID: | CAByBP0oSftfkNWtAu5gRVUH5CFXKGTu5TKtM87BvL5eM5Z9cAw@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-novice |
I'm having trouble with the IN operator when querying a Postgresql db using
the psql command line tool. Now that I think of it, I've never gotten the
IN operator to work before. And now it's critical. I'm using the psql tool
in a Windows 7 command window, version is 7.4.6.
I wonder if I'm missing something basic, which is not even in the manuals
I've been reading. I want to find a string field in an array of strings. I
want to limit the costcenter I'm selecting on and the costcenter is a
string. I've already googled to find some help but have found no info or
examples on using IN with an array of strings. So here's what I'm trying to
do:
AND (TRIM(tbl.costcenter) IN ('540'))
This results on no error, but also no records. When I take this simple
clause out, I get records. I've also tried using regex, and get the same
result: no records are returned.
AND ((tbl.costcenter ~* '^(540|001)$') )
Can anyone shed some light on this for me?
Thank you.
From | Date | Subject | |
---|---|---|---|
Next Message | David G. Johnston | 2017-02-03 17:37:21 | Re: Trouble with IN operator |
Previous Message | valeriof | 2017-02-01 09:52:26 | Re: Deployment of an output plugin in Unix-like environment |