| From: | Doug Silver <dsilver(at)quantified(dot)com> | 
|---|---|
| To: | pgsql-novice(at)postgresql(dot)org | 
| Subject: | select IN problem | 
| Date: | 2002-02-22 21:36:27 | 
| Message-ID: | Pine.LNX.4.21.0202221326400.10661-100000@danzig.sd.quantified.net | 
| Views: | Whole Thread | Raw Message | Download mbox | Resend email | 
| Thread: | |
| Lists: | 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
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Pam Wampler | 2002-02-22 21:51:08 | Question 7.1.3>>7.2 | 
| Previous Message | john-paul delaney | 2002-02-22 21:11:42 | Re: Nu-B\Column:Alter type |