mysql中 where in 用法详解
来源:互联网 发布:郑州网络销售抓人 编辑:程序博客网 时间:2024/06/05 23:49
这里分两种情况来介绍
1、in 后面是记录集,如:
select * from table where uname in(select uname from user);
2、in 后面是字符串,如:
select * from table where uname in('aaa',bbb','ccc','ddd','eee',ffff'');
注意:这里一定要将字符串用单引号'' 标注起来;
3、in 后面是数组,用如下方法,请参考:
//$pieces是含数据的数组
for($i=0;$i<count($pieces);$i++){
$uname=$uname."'".$pieces[$i]."',";
}
$the_uname ="uname in(".$uname."'')";
select * from table where ".$the_uname." ;
备注:这种方法的原理其实很简单,二就是把数组编程上面“第2种情况”的形式
- 顶
阅读全文
0 0
- mysql中 where in 用法详解
- mysql中 where in 用法详解
- mysql中 where in 用法详解
- mysql中 where in 用法详解
- mysql中where in用法
- SQL中where in的用法
- mysql中where字句的特殊用法
- MySQL where in 排序
- WHERE语句中BETWEEN与IN的使用教程-MySQL
- yii2 where in的用法
- mysql中using() having where 的用法区别
- mysql中haveing用法(同where类似)
- mysql中having的用法(和where的区别)
- mysql中having的用法(和where的区别)
- 优化mysql中where or和where in语句的效率
- mysql delete where not in
- mysql怎么使用 where in
- SQL 中用法详解 string where = " where 1=1 ";
- Hadoop入门-配置Hadoop-2.8
- 谈谈Linux下动态库查找路径的问题
- ssh和ejb的区别
- mathematica进制(数字格式)转换
- Effective Java 学习笔记——第二章
- mysql中 where in 用法详解
- jira中svn地址显示为link的实现
- Java中的八种基本数据类型
- Redis Select 命令
- 设计模式资源清单
- 微信小程序之 PHP 发送模板消息
- BibTeX 生成自定义的参考文献
- 本周学习小结
- gitlab部署、配置更改、备份及恢复