DEV Community

Manav Misra
Manav Misra

Posted on

How To Use DISTINCT With a Join?

-1

This is practice with the MySQL Employees DB. The diagram for it is here.

I want to know the top 10 salaries.salary, by employees.gender.

I have tried:

SELECT DISTINCT employees.emp_no, employees.first_name, employees.last_name, employees.gender, salaries.salary
FROM employees 
JOIN salaries ON employees.emp_no = salaries.emp_no 
ORDER BY salaries.salary DESC 
LIMIT

Top comments (0)