日期:2014-05-17  浏览次数:20972 次

求助,多条件查询排序问题
id title dept nationality 
1 aa gove China
2 bb priv france
3 cc gov Germany
4 aa priv China

select * from test where title like '%aa%' or dept like '%priv%' or nationality like '%China%'

如何排序得到

4 aa priv China
1 aa gove China
2 bb priv france


------解决方案--------------------
探讨
我排列搜索后的结果原因
4 aa priv China 满足3个like
1 aa gove China 满足2个like
2 bb priv france 满足1个like