Find Employees With Matching Salary Values

Find employees who have the same salary as another employee.

sql

SELECT e1.id, e1.name, e1.salary FROM employees e1 JOIN employees e2 ON e1.salary = e2.salary AND e1.id <> e2.id;

This query performs a self-join on the "employees" table to identify records that share an identical "salary" value while ensuring the records compared are not the same individual.

PromptDB can make mistakes. Please double-check responses.