How TO SELECT DISTINCT records in mysql uisng JOIN on four tables
<p>I have four tables named college_list, course_list, branch_list, semester_list. And have applied JOIN on these tables as under.</p>

<pre><code> SELECT DISTINCT college_list.clg_name, course_list.crs_name, branch_list.bran_name, semester_list.sem_name FROM college_list 
       LEFT JOIN course_list ON college_list.clg_code = course_list.crs_clg_code
       LEFT JOIN branch_list ON course_list.crs_code = branch_list.bran_crs_code
       LEFT  JOIN semester_list ON branch_list.bran_crs_code = semester_list.sem_crs_code GROUP BY bran_name
       UNION ALL
       SELECT DISTINCT college_list.clg_name, course_list.crs_name, branch_list.bran_name, semester_list.sem_name FROM college_list 
       RIGHT JOIN course_list ON college_list.clg_code = course_list.crs_clg_code
       LEFT JOIN branch_list ON course_list.crs_code = branch_list.bran_crs_code
       LEFT  JOIN semester_list ON branch_list.bran_crs_code = semester_list.sem_crs_code GROUP BY bran_name
       UNION ALL
       SELECT DISTINCT college_list.clg_name, course_list.crs_name, branch_list.bran_name, semester_list.sem_name FROM college_list 
       RIGHT JOIN course_list ON college_list.clg_code = course_list.crs_clg_code
       RIGHT JOIN branch_list ON course_list.crs_code = branch_list.bran_crs_code
       LEFT  JOIN semester_list ON branch_list.bran_crs_code = semester_list.sem_crs_code GROUP BY bran_name
       UNION ALL
       SELECT DISTINCT college_list.clg_name, course_list.crs_name, branch_list.bran_name, semester_list.sem_name FROM college_list 
       RIGHT JOIN course_list ON college_list.clg_code = course_list.crs_clg_code
       RIGHT JOIN branch_list ON course_list.crs_code = branch_list.bran_crs_code
       RIGHT  JOIN semester_list ON branch_list.bran_crs_code = semester_list.sem_crs_code GROUP BY bran_name
</code></pre>

<p>The result of this query is as below.</p>

<p><a href="https://i.stack.imgur.com/VukXx.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/VukXx.jpg" alt="enter image description here"></a></p>

<p>But I want the college name to come for once. And same with other columns.
So how can I use GROUP BY or DISTINCT commands to get so?</p>