Hello I have a Employee Table with following columns
Emp_id, Emp_Name and Mgr_id.
I am trying to create a view which will list
Emp_id, Emp_name, Mgr_id and Mgr_name
(by cross joining the Employee table). I tried outer join, inner join etc, but I am not able to get it right.
Any help is highly appreciated.
CREATE TABLE [dbo].[tblEmployeeDetails](
[emp_id] [bigint] NOT NULL,
[emp_name] [nvarchar](200) NULL,
[emp_mgr_id] [bigint] NULL, CONSTRAINT [PK_tblEmployeeDetails] PRIMARY KEY CLUSTERED (
[emp_id] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] ) ON [PRIMARY]
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…