匹配量排序
来源:互联网 发布:js array 清空数组 编辑:程序博客网 时间:2024/05/17 20:25
我爱北京天安门
天安门上太阳升
伟大领袖毛主席
指引我们向前进
--生成测试数据
declare @t table(id int,name varchar(20))
insert into @t select 1,'中国湖南长沙芙蓉区'
insert into @t select 2,'中国福建福州鼓楼区'
insert into @t select 3,'中国北京北京朝阳区'
insert into @t select 4,'中国河南郑州金水区'
--查询示例
select
*,
(case when name like '%中国%' then 1 else 0 end +
case when name like '%湖南%' then 1 else 0 end +
case when name like '%长沙%' then 1 else 0 end +
case when name like '%州%' then 1 else 0 end) as 匹配量
from
@t
where
name like '%中国%' or name like '%湖南%' or name like '%长沙%' or name like '%州%'
order by
匹配量 desc
--输出结果
/*
id name 匹配量
----------- -------------------- -----------
1 中国湖南长沙芙蓉区 3
2 中国福建福州鼓楼区 2
4 中国河南郑州金水区 2
3 中国北京北京朝阳区 1
*/
- 匹配量排序
- 按点击量排序
- 时间和数量排序
- 排序和顺序统计量
- mysql使用临时量排序
- oc Block / NSComparisonResult排序 / 字面量
- zoj3211 按增长量排序 然后dp
- 第二部分 排序和顺序统计量
- 单用户量收匹配原则在收入分析中的应用
- 排序和顺序统计量与堆排序
- 排序和顺序统计量之堆排序
- 排序和顺序统计量之简单选择排序
- MYSQL 关键字 相关性排序 匹配度排序
- 【OPNET小问题】统计量显示收发数据数量不匹配以及如何导出统计量数据
- ajax json 表格排序,分页,自定义每页数量
- Block与数组排序,局部变量,字面量
- 排序和顺序统计量(算法导论)
- [学习《算法导论》]第二部分 排序和顺序统计量
- ServerVariables 集合检索预定的环境变量
- 笔记(060623),chained row,speed of long raw data retriving
- 详细解说STL string
- ASP.NET页面的重定向
- 串起珍珠的项链
- 匹配量排序
- 存储过程中自动拆分输入框里的字符,然后跟表里的两三个字段去匹配
- 广州淘金记:小女孩身无身文赚百万
- 很有意思的转动
- 判断机器IP是公网ip还是内网ip
- ASP.NET.2.0.in.C.Sharp.2005.From.Novice.to.Professional的读书笔记[1]
- Domino的Java环境配置:
- 服务器500 Internal Server Error故障简要分析
- 按周显示每年的销售对比