Relational icon indicating copy to clipboard operation
Relational copied to clipboard

Many-to-many using the same table 2 times

Open mrsoto opened this issue 10 years ago • 2 comments

Hello, How columns should be names to allow a many-to-many relationship when the same table is referenced, for example

table customer(id)
table customer_customer(id, customer_id, other_customer_id, other_data)

how the other_customer_id should be named to be respect compliant?

mrsoto avatar Oct 28 '15 03:10 mrsoto

I can't find right now a way to do that without setting a custom Style or defining a third table to perform that...

nawarian avatar Dec 07 '15 23:12 nawarian

I have been using views for that:

CREATE TABLE customer(id ...);
CREATE VIEW friend AS SELECT * FROM customer;
CREATE TABLE customer_friend(id .., customer_id ..., friend_id ..., friendship_status ...);

The view friend mimics the customer table and allows relational to target the same data using different collection names. Hope it helps.

alganet avatar Dec 08 '15 15:12 alganet