Wrox Home  
Search P2P Archive for: Go

  Return to Index  

access thread: recursive relationships?


Message #1 by selman@b... on Sun, 18 Nov 2001 14:12:40
Does anyone know how do you implement self referencing (recursive) 

relationships in Access2000 of the type:



create table tbl_employee

(

    employee_id char(10),

    supervisor_id char(10) not null,

    primary key (employee_id),

    foreign key (supervisor_id) references tbl_employee

        on delete set default on update cascade

)



             -----------

            |           |

            | employee  |

            |           |----

             -----------    |

                    \|/     |  is_supervisor_of

                     --------



cheers



Message #2 by "Pardee, Roy E" <roy.e.pardee@l...> on Sun, 18 Nov 2001 09:22:34 -0800
It looks goofy, but here's how you do it.  In the relationships view, add

your table twice.  The second instance of the table will have a "_1"

appended to it--that is, you'll have a tbl_employee and a tbl_employee_1.

Then establish your relationship as if they really were two different

tables.



HTH,



-Roy



Roy Pardee

Programmer/Analyst

SWFPAC Lockheed Martin IT

Extension 8487



-----Original Message-----

From: selman@b... [mailto:selman@b...]

Sent: Sunday, November 18, 2001 6:13 AM

To: Access

Subject: [access] recursive relationships?





Does anyone know how do you implement self referencing (recursive) 

relationships in Access2000 of the type:



create table tbl_employee

(

    employee_id char(10),

    supervisor_id char(10) not null,

    primary key (employee_id),

    foreign key (supervisor_id) references tbl_employee

        on delete set default on update cascade

)



             -----------

            |           |

            | employee  |

            |           |----

             -----------    |

                    \|/     |  is_supervisor_of

                     --------



cheers








Message #3 by selman@b... on Sun, 18 Nov 2001 19:31:20
Cheers. I'll try that.



> It looks goofy, but here's how you do it.  In the relationships view, add

> your table twice.  The second instance of the table will have a "_1"

> appended to it--that is, you'll have a tbl_employee and a tbl_employee_1.

> Then establish your relationship as if they really were two different

> tables.

> 

> HTH,

> 

> -Roy

> 

> Roy Pardee

> Programmer/Analyst

> SWFPAC Lockheed Martin IT

> Extension 8487


  Return to Index