clear markdown help donate comments/suggestions/bugs a leap of faith?
clear markdown donate comments/suggestions/bugs a leap of faith?
By using dbfiddle, you agree to license everything you submit by Creative Commons CC0

create table SampleData ( Id int not null , Name nvarchar(32) ) insert SampleData (Id, Name) values (1, 'Select') , (2, 'Emp_id') , (3, ',') , (4, 'Emp_Name') , (5, 'AS') , (6, 'EmployeeName') , (7, ',') , (8, 'Dept_Name') , (9, 'AS') , (10, 'DepartmentName') , (11, 'CASE') , (12, 'WHEN') , (13, 'Emp_Status=''Y''') , (14, 'THEN') , (15, '1') , (16, 'ELSE') , (17, '0') , (18, 'END') , (19, 'AS') , (10, 'EmployeeStatus') , (11, 'From') , (12, 'Employee') select b.Id, a.Name + ' ' + b.Name + ' ' + c.Name StrName from SampleData b inner join SampleData a on a.Id = b.id - 1 inner join SampleData c on c.Id = b.id + 1 where b.Name = 'AS'
Id StrName
5 Emp_Name AS EmployeeName
9 Dept_Name AS DepartmentName
9 Dept_Name AS EmployeeStatus