select ... where ... in - headache

Поиск
Список
Период
Сортировка
От Ian W Roberts
Тема select ... where ... in - headache
Дата
Msg-id 3de9c827@kastagir.senet.com.au
обсуждение исходный текст
Ответы Re: select ... where ... in - headache  (Scott Lamb <slamb@slamb.org>)
Список pgsql-general
Can someone help me?

I'm using Pg to access a postgres database for a web application. I have an
apparently robust database connection and have been using Pg::doQuery to
return a list-of-lists of the data
-all working OK.

However, I've been trying to process the following command without success:

select <some fields>  from table1 where keyfield in (select keyfield from
table2);

This exact command returns the correct data when entered at the command
prompt in my POSTGRESQL interactive sql monitor but consitently returns no
data via the Pg::doQuery.

If I replace the nested select statement with a list of values then the
command works correctly, eg:

select <some fields> from table1 where keyfield in (15,17) ;

Is there some reason why the nested statement doesn't/cannot work with Pg?

How can I achieve the same result?

TIA

ian


Software versions:

PostgreSQL 6.5.3 on i686-pc-linux-gnu, compiled by gcc egcs-2.91.66
Perl 5.005, patch 03




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

Предыдущее
От: "j.random.programmer"
Дата:
Сообщение: Postgresql -- initial impressions and comments
Следующее
От: "Wynn, Robin"
Дата:
Сообщение: Backend message type 0x50 arrived while idle