Follow Steps:
--1.Creating the Employee table
CREATE TABLE Emp(emp_id int, manger_id int,employee_name varchar(20))
--2.Inserting the value
Follow Steps:
--1.Creating the Employee table
CREATE TABLE Emp(emp_id int, manger_id int,employee_name varchar(20))
--2.Inserting the value
Join the conversation! Your thoughts help the community grow.
Sign in to leave a comment
It is the same account you read, post and publish with — and you will come straight back to this page.
INSERT INTO Emp VALUES(1,1,'T1'),(2,1,'T2'),(3,2,'T3'),(4,1,'T4')
--3.The self join query
SELECT emp.emp_id,emp.employee_name [Emb], mgr.employee_name [Manager] FROM Emp, Emp mgr WHERE emp.manger_id = mgr.emp_id
Abdu RafeeqPosted Dec 4, 2013, 12:01 AM
use alias ,,,