Relational
Relational copied to clipboard
Many-to-many using the same table 2 times
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?
I can't find right now a way to do that without setting a custom Style or defining a third table to perform that...
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.