How to maintain ordered list of records in relationship N: N

1

Considering a scenario where a author can hold multiple posts and a post can have several authors an intermediate table to maintain relationships.

However, the order of the authors in a publication is chosen by the client at the time of creation or publishing .

In this case would it be feasible to maintain an attribute (for example, JSON) in the publication table to save the ordered keys of the relationships?

How to maintain order in the list of authors?

EXAMPLE OF A CASE

user1 creates publication1 and relates to it, in addition to it (which is automatically related by being the creator), users: user2 >, user3 and user4 .

However, he wants the authors of this publication to be shown in the following order: user4 , user1 , user3 / em>.

Any of the authors can change this order later.

    
asked by anonymous 15.09.2015 / 16:33

1 answer

2

Just save the order in the relationship table (intermediate), so you know the order for each author in that publication.

Demo

    
15.09.2015 / 17:07