From: | "Knut P(dot) Lehre" <k(dot)p(dot)lehre(at)tiscali(dot)no> |
---|---|
To: | pgsql-novice(at)postgresql(dot)org |
Subject: | subselects? |
Date: | 2003-04-23 15:54:08 |
Message-ID: | 5.1.0.14.2.20030423165621.02145670@uio-pop.uio.no |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-novice |
In a table (T1) there are several columns. Two of them together make up a
link to any row in the same database: one column (T1C5) is a string
representing the name of a table, and the other (T1C6) an int representing
the id of a row in the table referred to in T1C5.
I want to write a query returning some columns from T1,
(T1C1,T1C2,T1C3,T1C4), and in the same result row, all of the columns from
the table with its name in T1C5 with and id in T1C6.
A simple select query using a join like (SELECT * FROM a LEFT JOIN b ON
(a.ref = b.id);) could be used if all the table names in the T1C5 column
were the same. However, they are not. Any suggestions on how to solve this
problem?
Thanks, KP
From | Date | Subject | |
---|---|---|---|
Next Message | Jay G. Scott | 2003-04-23 17:44:29 | PQexec just spins. burns CPU, doesn't do anything. |
Previous Message | Tom Lane | 2003-04-23 15:47:30 | Re: postgresql-7.3 implementation |