From: | "Ian W Roberts" <Ian(dot)W(dot)Roberts(at)adelaide(dot)edu(dot)au> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | select ... where ... in - headache |
Date: | 2002-12-01 08:26:52 |
Message-ID: | 3de9c827@kastagir.senet.com.au |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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
From | Date | Subject | |
---|---|---|---|
Next Message | Daniel Morgan | 2002-12-01 10:15:03 | PostgreSQL 7.3 Win32 Binaries |
Previous Message | Nicolai Tufar | 2002-12-01 07:32:47 | Re: Segmentation fault while COPY in 7.3 |