Mysql利用Like支援根據匹配度進行查詢

FeelTouch發表於2018-07-10

方式一:直接利用replace進行

SELECT * FROM `people` WHERE namess LIKE '%999%' ORDER BY REPLACE(namess,'999','');

方式二:對length(replace())進行

select *, (length(phone_number)-length('999')) as rn from treasure_lottery_prize where phone_number like '%999%' order by rn;

相關文章