Search LIKE is correct in 2 following cases:
1. select Orders.ShipName from Orders where Orders.ShipName LIKE 'a%'
2. select Orders.ShipName from Orders where Orders.ShipName LIKE '_a%'
Note: (_) is blank.
But now I want to search LIKE use both 2 conditions above with records of condition 1 come first, then records of condition 2 come next. I try:
select Orders.ShipName from Orders where Orders.ShipName like 'a%' OR Orders.ShipName LIKE '%_a%'
But records mixed up each other between 2 conditions. Please give me a solution. Thanks a lot.
How to combine 2 conditions in search LIKE
2 Answers
Know the answer? Post it. Somebody with the same question will find it here.

Amit ChoudharyRank #145 · 15.8K reputationPosted May 1, 2010, 1:39 AM EDT
Try nested query... first fetch the result on basis of your first condition and then pass this result to outer query with second condition.. and your problem will be solved.
Select Orders.ShipName from (select Orders.ShipName from Orders where Orders.ShipName LIKE 'a%') where Orders.ShipName LIKE '_a%'See if it works for you.
Please mark "Do you like this post" if it helps you.
Venkatesan JayakanthamRank #256 · 9.8K reputationPosted Jun 11, 2010, 5:37 AM EDT
select Orders.ShipName from Orders where Orders.ShipName LIKE 'a%'
union
select Orders.ShipName from Orders where Orders.ShipName LIKE '_a%'
Cheers,
Venkatesan Prabu .Jhttp://venkattechnicalblog.blogspot.com/