Say i have 3 customer names:
Microsoft
Another customer also called Microsoft
A third customer called Microsoft
Now if i query the customers like this…
var q = (from cust in db.Cust
where cust.Name.Contains("Microsoft")
orderby cust.Name ascending
select cust)
…i get this order:
A third customer called Microsoft
Another customer also called Microsoft
Microsoft
What i want is to get Microsoft first, based on the fact that it starts with “Microsoft”.
Changing Contains to StartsWith of course leaves me with 1 result instead of 3.
Could this be done in a single query?
Maybe