i have a mysql query like:
select * from employee
where name like '%ani%'
I want my results to be order by starting with ani for eg. my results should be comming as: {anil,anirudha,rani, ...} starting with ani first and then followed by other characters.
Can anybody please help me on this.
for mssql server repalce
if
withcase when
with the syntax provided, is easy to replace 'ani' with any value you want
Something like
Should do the trick ... (sort by position of the substring in the whole string)
You can possibly use a union to achieve this:
Edit: Added the second solution.
Solution 1:
Solution 2:
I am not entirely sure exactly what you are looking for. If you would like to just order the results of that query by name: