| From: | <operationsengineer1(at)yahoo(dot)com> |
|---|---|
| To: | pgsql-novice(at)postgresql(dot)org |
| Subject: | Re: fk problems with 0..n relations |
| Date: | 2005-12-06 01:13:59 |
| Message-ID: | 20051206011359.57266.qmail@web33312.mail.mud.yahoo.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-novice |
--- Luis Silva <lfs12(at)hotmail(dot)com> wrote:
> I there, i'm having a problem. i have a table(1)
> that is connected with two multiple table (2 and 3).
> the problem is that the table 1 might have one of
> the tables (2 or 3, or both). how can i make this
> relationship in sql. Resuming, table 1 as a 0..n
> relation with table 2 and 3. thanks in advance.
Louis, i'm not sure i understand your question fully.
it would help if you post sample data (even if made
up).
in any case, someone mentioned that you could link
table 1 as follows:
table_1:
news_id
news
table_2:
image_id
image
fk_news_id
table_3
comment_id
comment
fk_news_id
if table 2 is linked to table 1, drop in news_id into
table_2.fk_news_id.
if table 3 is linked to table 1, drop in news_id into
table_3.fk_news_id.
drop in both if it is linked to both.
does this answer your question?
__________________________________________
Yahoo! DSL Something to write home about.
Just $16.99/mo. or less.
dsl.yahoo.com
| From | Date | Subject | |
|---|---|---|---|
| Next Message | William Yu | 2005-12-06 01:18:25 | Re: Need help building SQL query |
| Previous Message | operationsengineer1 | 2005-12-06 00:20:22 | Re: SQL Statement Help Needed |