I have table like TB1:
Emp_name Dept_name salary
Girish BB 20000
Bhanu AA 10000
Mahesh CC 10000
Seema YY 30000
The output I need is:
Emp_name Dept_name salary
Mahesh CC 10000
Bhanu AA 10000
Girish BB 20000
Seema YY 30000
Here what I have done is gave priority to 'Mahesh' and rest all the employees are sorted asc.
I tried this query:
SELECT *
FROM Employee
ORDER BY CASE
WHEN Emp_name LIKE '%Mahesh%' THEN 1
WHEN Emp_name LIKE '%' THEN 2
ELSE 3
end;
Thank you for your time.