Question: I have one table in my DB containing set of names. I need to use order by condition to sort the names alphabetically except one name which should print on top of the list if the user name is Say 'John'. I got one SQL query, but
How do i use this following query in linq?

```
SELECT name
FROM names
ORDER BY
  CASE WHEN name = 'John' THEN 0 ELSE 1 END,
name

```

Answer: 
You could also do it this way:

```
var result =
    db.names
        .ToArray()
        .OrderBy(x => (x.Name == "John" ? "0" : "1") + x.Name)
        .ToArray()

```
you can do the following

```
var listWithoutJohn=db.names.Where(t=>t.name!="John").OrderBy(t=>t.name).ToArray();
var johnList=db.names.Where(t=>t.name=="John").ToList();
var result=johnList.AddRange(listWithoutJohn);

```

hope this will help you