I have 2 tables, one for courses names (named `Courses`) and one for universities that teach the course (named `Unicourses`).

I want to select all the columns from `UniCourses` and also `coursename` column from `Courses` table.

Everything goes well but I have repeated values in the query result, and I want all `coursename` column to be unique.

I tried using DISTINCT but I can't manage to make it work.

this is the query I'm using:

```
SELECT 
    UniCourses.courseid, UniCourses.uniname, 
    UniCourses.rating, UniCourses.ratingppl, 
    UniCourses.approved,
    Courses.courseid, Courses.coursename  
FROM 
    UniCourses 
INNER JOIN 
    Courses ON UniCourses.courseid = Courses.courseid  
WHERE 
    UniCourses.approved = 1  
ORDER BY 
    UniCourses.rating / CASE UniCourses.ratingppl WHEN 0 THEN 1 ELSE UniCourses.ratingppl END DESC;

```

This is what I get

```
|courseid|uniname|rating|ratingppl|approved|coursename|
_______________________________________________________
|    4   |howard | 20   |    5    |    1   |  algebra |
|    4   |hampton| 10   |    2    |    1   |  algebra |

```

this is what I want

```
|courseid|uniname|rating|ratingppl|approved|coursename|
_______________________________________________________
|    4   |hampton| 10   |    2    |    1   |  algebra |

```

As you can see, these are the same course that 2 universities teach, 
I want only 1 to appear, that has the highest rating which is calculated by 
( rating / ratingppl );

`Courses` table columns:

```
courseid, coursename

```

`Unicourses` table columns:

```
courseid, uniname, rating, ratingppl, approved

```