R
R
Rastorc3v2020-12-09 23:30:19
PostgreSQL
Rastorc3v, 2020-12-09 23:30:19

How convenient to implement a many-to-many relationship?

There are two tables. One with academic councils, and the other with specialties. A many-to-many relationship is organized through an intermediate table. The problem is that the query below results in duplicate council information for each specialty (see picture). Sending from the server and processing such information is not comme il faut (it would be more convenient if the specialties were in the list and occupied one line for each tip). What is the best solution in this situation?

SELECT branch_id, c.council_id, c.expiration_date, c.creation_date
    from council_branch cb
    INNER JOIN council c ON cb.council_id=c.council_id

5fd133489d6c1684750421.png

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question