select IN problem

Поиск
Список
Период
Сортировка
От Doug Silver
Тема select IN problem
Дата
Msg-id Pine.LNX.4.21.0202221326400.10661-100000@danzig.sd.quantified.net
обсуждение исходный текст
Ответ на Re: Nu-B\psql:Command Recall,Repeat?  (john-paul delaney <jp@justatest.com>)
Ответы Re: select IN problem  (Andrew McMillan <andrew@catalyst.net.nz>)
Список pgsql-novice
I've read the IN chapter in Bruce M.'s Postgresql book, but I still can't
seem to get my select/IN to work.  I have two tables, transactions and
transactions_detail, with the transaction_id field as the reference in
the transactions_detail table.

# select transaction_id from transactions where enter_date> cast('2002-02-22' as date);
 transaction_id
----------------
           2043
           2044
           2045

purchases=# select transaction_id from transactions_detail where transaction_id>2042;
 transaction_id
----------------
           2043
           2044
           2045

purchases=# \d transactions_detail
            Table "transactions_detail"
   Attribute    |         Type          | Modifier
----------------+-----------------------+----------
 transaction_id | smallint              |
 products       | character varying(20) |
 quantities     | smallint              |

But the following query causes it to hang, after 10 seconds I finally stop
it.

purchases=# select transaction_id from transactions_detail where
purchases=# transaction_id IN (
purchases=# select transaction_id from transactions where enter_date> cast('2002-02-22' as date)
purchases=# );

Any suggestions?

Thanks!

--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Doug Silver
Network Manager
Quantified Systems, Inc
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~




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

Предыдущее
От: Lewis Bergman
Дата:
Сообщение: indexes on multiple columns
Следующее
От: Pam Wampler
Дата:
Сообщение: Question 7.1.3>>7.2