title: Trying to use CTE to replace codes with names
body: <p>Expecting to get names instead of codes which is highlighted in yellow.</p>
  <p><a href="https://i.stack.imgur.com/oZubj.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/oZubj.png" alt="enter image description here" /></a></p>
  <p><a href="https://i.stack.imgur.com/dx1jd.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/dx1jd.png" alt="enter image description here" /></a></p>
  <p><a href="https://i.stack.imgur.com/Sv7zz.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Sv7zz.png" alt="enter image description here" /></a></p>
  <p><strong>Employee Table</strong></p>
  <pre><code>CREATE TABLE [dbo].[_Employees](
      [Name] [nvarchar](50) NULL,
      [Code] [nvarchar](50) NULL
  ) ON [PRIMARY]
  
  GO
  INSERT [dbo].[_Employees] ([Name], [Code]) VALUES (N'A', N'1')
  GO
  INSERT [dbo].[_Employees] ([Name], [Code]) VALUES (N'B', N'2')
  GO
  INSERT [dbo].[_Employees] ([Name], [Code]) VALUES (N'C', N'3')
  GO
  </code></pre>
  <p><strong>Data Table</strong></p>
  <pre><code>CREATE TABLE [dbo].[_Details](
      [Department] [nvarchar](50) NULL,
      [Zone] [nvarchar](50) NULL,
      [Place] [nvarchar](50) NULL,
      [City] [nvarchar](50) NULL,
      [L1] [nchar](10) NULL,
      [L2] [nchar](10) NULL,
      [L3] [nchar](10) NULL
  ) ON [PRIMARY]
  
  GO
  INSERT [dbo].[_Details] ([Department], [Zone], [Place], [City], [L1], [L2], [L3]) VALUES (N'Department1', N'Zone1', N'Place1', N'City1', N'1         ', N'2         ', N'3         ')
  GO
  INSERT [dbo].[_Details] ([Department], [Zone], [Place], [City], [L1], [L2], [L3]) VALUES (N'Department2', N'Zone2', N'Place2', N'City2', N'3         ', N'2         ', N'1         ')
  GO
  INSERT [dbo].[_Details] ([Department], [Zone], [Place], [City], [L1], [L2], [L3]) VALUES (N'Department3', N'Zone3', N'Place3', N'City3', N'2         ', N'3         ', N'1         ')
  GO
  </code></pre>
  <p><strong>My Attempt</strong></p>
  <pre><code>WITH _Details AS 
  ( 
      SELECT L1 FROM _Details 
      UNION ALL 
      SELECT e.Name FROM _Employees e INNER JOIN _Details d  ON e.Code = d.L1 
  ) 
  SELECT * FROM _Details
  </code></pre>
  <p>Not sure what I am doing wrong?</p>