I am new to sql so please be kind.
Assume i must display all the employee_ids which have the same phone number(Both columns are in the same table)
How am i to proceed on this problem inner join or something.
SELECT * FROM employees e1, employees e2 WHERE e1.phoneNumber = e2.phoneNumber AND e1.id != e2.id;
Update : for better performance and faster query its good to add e1
before *
SELECT e1.* FROM employees e1, employees e2 WHERE e1.phoneNumber = e2.phoneNumber AND e1.id != e2.id;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With