Results 1 to 3 of 3
  1. #1
    Join Date
    Dec 2002
    Posts
    8

    Unhappy Unanswered: View and link table

    View and link table
    Hello

    I'm searching some help about views and link table. I have three tables, a
    link table has three rows refering elements in the two others table. I make an example



    /*================================================= =============*/
    /* Table : ASSOCIATE */
    /*================================================= =============*/
    create table ASSOCIATE (
    IDT1 int not null,
    IDT2 int not null,
    constraint PK_ASSOCIATE primary key (IDT1, IDT2)
    )
    go


    /*================================================= =============*/
    /* Table : T1 */
    /*================================================= =============*/
    create table T1 (
    IDT1 int not null,
    constraint PK_T1 primary key (IDT1)
    )
    go


    /*================================================= =============*/
    /* Table : T2 */
    /*================================================= =============*/
    create table T2 (
    IDT2 int not null,
    constraint PK_T2 primary key (IDT2)
    )
    go


    alter table ASSOCIATE
    add constraint FK_ASSOCIAT_ASSOCIATE_T1 foreign key (IDT1)
    references T1 (IDT1)
    go


    alter table ASSOCIATE
    add constraint FK_ASSOCIAT_ASSOCIATE_T2 foreign key (IDT2)
    references T2 (IDT2)
    go

    I want to create a view to have something like this

    My view must return each element fom T2 in relation with T1, in one fetch for each row.

    But I don't find a solution to do the difference between the result and I have something like this :

    It stays on the first element even I do the join for each elements.

  2. #2
    Join Date
    Feb 2002
    Location
    Houston, TX
    Posts
    809
    Not exactly sure what you are looking for. Do you need to return the union of these tables? Post back and I will try to help.
    Paul Young
    (Knowledge is power! Get some!)

  3. #3
    Join Date
    Dec 2002
    Posts
    8
    TABLE A
    1 Car

    Table B
    1 Father
    2 Mother
    3 Grand Father

    Table C This is the link table
    1 1
    1 2
    1 3

    My view must return

    1 Father Mother Grand Father

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •