DEV Community

loading...

How To Use DISTINCT With a Join?

Manav Misra
I'm a JS Subject Matter Expert (SME) that has spent the past few years spearheading curricula and teaching initiatives at colleges and bootcamps, in person and virtually.
・1 min read

How To Use DISTINCT With a Join?

0

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

Discussion (0)