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.