我输入了一个单词“boat”,所以我需要以boat 开头并且包含“boat”的记录。但必须首先出现以“boat”开头的记录
我试过以下
Select AsiccCodeId,AsiccDescription
FROM AsiccCodeMaster c
WHERE c.AsiccDescription like 'boat%' or c.AsiccDescription like '%boat%'
和
select a.* from
(
Select AsiccCodeId,AsiccDescription
FROM AsiccCodeMaster c
WHERE c.IsActive = 1 and (GoodFor = 'M' or GoodFor = 'B')
and c.AsiccDescription like 'Unmilled%'
UNION
Select AsiccCodeId,AsiccDescription
FROM AsiccCodeMaster c
WHERE c.IsActive = 1 and (GoodFor = 'M' or GoodFor = 'B')
and c.AsiccDescription like '%Unmilled%'
)a
但它给了我
4137 Combustion Boats
6360 Boat, Fibre
6361 Boat, Rubber - Motorized
6362 Boat, Wooden Canal Boats
6363 Boat, Wooden With Engine
6370 Wooden Boats Body Building
6374 Boat, Rowing / Sports
6375 Boat, Rubber - Nonmotorized
6376 Boat, Wooden Without Engine-Others
6379 Parts Of Ships, Boats Etc., N.E.C
6391 Ships, Boats & Other Vessels, N.E.C
6394 Ships, Boats & Other Vessels, N.E.C
我需要首先以“boat”开头的记录,然后是包含“boat”的记录