[NOVICE] Trouble with IN operator

Поиск
Список
Период
Сортировка
От Chuck Roberts
Тема [NOVICE] Trouble with IN operator
Дата
Msg-id CAByBP0oSftfkNWtAu5gRVUH5CFXKGTu5TKtM87BvL5eM5Z9cAw@mail.gmail.com
обсуждение исходный текст
Ответы Re: [NOVICE] Trouble with IN operator  ("David G. Johnston" <david.g.johnston@gmail.com>)
Re: [NOVICE] Trouble with IN operator  ("David G. Johnston" <david.g.johnston@gmail.com>)
Список 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.



В списке pgsql-novice по дате отправления:

Предыдущее
От: padmini
Дата:
Сообщение: Re: [NOVICE] Postgres authentication to multiple application servers
Следующее
От: "David G. Johnston"
Дата:
Сообщение: Re: [NOVICE] Trouble with IN operator