Posted by Sana, Sept. 6, 2023, 7:17 a.m.
SQL
How to find the same values for columns in single SQL table
Posted by Sana, Sept. 6, 2023, 7:17 a.m.
How to find the same values for columns in single SQL table
Can you expand on what you're trying to do a little more as there are various ways this might work.
You can check for rows where multiple columns have the same value (ie, WHERE col1 = col2).
You can also do a self-join, such as:
SELECT a.employee_id, a.name, b.name as supervisor_name
FROM employees a
LEFT JOIN employees b
ON a.supervisor_id = b.employee_id
The details depend on exactly what you're wanting to do with a given dataset.
Great example Mike! Thanks for sharing your thoughts on this.