mysql 函数 find in set()
2016-04-11 15:56
661 查看
字符串中查找不用in 用find in set()
语句的排序问题:
select id from test_select_in where id in(id) order by field(id);
select id,number from test_select_in where number in(id)
order by field(number,id);
select id from test_select_in where id in(id)
order by find_in_set(id,'id');
存在效率问题,特别是数据量较大的时候。所以最好还是直接返回结果然后在应用程序里重新排序。
语句的排序问题:
select id from test_select_in where id in(id) order by field(id);
select id,number from test_select_in where number in(id)
order by field(number,id);
select id from test_select_in where id in(id)
order by find_in_set(id,'id');
存在效率问题,特别是数据量较大的时候。所以最好还是直接返回结果然后在应用程序里重新排序。
相关文章推荐
- mysql的limit经典用法及优化
- mysql中datetime比较大小问题
- mysql使用的语句总结
- MySQL 入门(五)—— 表的操作
- mysql xtrabackup在线搭建主从
- mysql存储过程详解
- MySQLlimit分页查询rest接口
- mysql中文乱码
- mysqldump备份数据下篇-mysqldump自动备份数据库
- mysql数据库
- mysql中or和in的效率测试
- mysql 5.7 安装和配置
- mysql安装文章汇总总结
- Mysql 5.6 ONLINE_DDL
- mysql 常用语句
- mysql相关总结
- mysql日期加减
- mysql设置远程登录
- 2、用mysqlWorkbench操作数据库
- MySQL 语句