2
Answers

How to combine 2 conditions in search LIKE

tuanbs

tuanbs

14y
3.4k
1

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.
Answers (2)