From: | Grzegorz Jaśkiewicz <gryzman(at)gmail(dot)com> |
---|---|
To: | Antonio Goméz Soto <antonio(dot)gomez(dot)soto(at)gmail(dot)com> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Using table name in column for joining |
Date: | 2010-01-05 15:38:17 |
Message-ID: | 2f4958ff1001050738g2a27442fwbd7e12c0168bbc9f@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Tue, Jan 5, 2010 at 3:30 PM, Antonio Goméz Soto
<antonio(dot)gomez(dot)soto(at)gmail(dot)com> wrote:
> Hello,
>
> I have a column in a table that contains the name of another table,
> and the id in that table.
>
> I would like to use this in a join statement. Is that possible?
not possible I'm afraid.
But have a look at concept of inheritance for something that might
suit you. Or just store everything in one table, but add new id to
each row. That is what other half of the world uses.
Also, when writing queries like that, consider using aliases for table
name, for instance:
select a.id from animals a;
makes life easier.
hth
--
GJ
From | Date | Subject | |
---|---|---|---|
Next Message | Pavel Stehule | 2010-01-05 15:43:18 | Re: Large tables, ORDER BY and sequence/index scans |
Previous Message | Claudio Eichenberger | 2010-01-05 15:35:33 | 8.4.1 & 8.4.2 require map=... for ident in the pg_hba.conf file, will this be the new way? |