mysql中 where in 用法详解
来源:互联网 发布:为什么卸载软件要重启 编辑:程序博客网 时间:2024/06/05 20:13
这里分两种情况来介绍
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 ";
- IDA*(poj 2286)
- 深入解析unsigned int 和 int
- Don’t Overwhelm Yourself Trying to Learn Too Much
- equals和 hashcode比较
- oakley sunglasses sale-371
- mysql中 where in 用法详解
- chanel online store-647
- louis vuitton outlet-214
- Codeforces Round #263 (Div. 2) C. Appleman and Toastman
- louis vuitton outlet-163
- cheap coach bags-875
- Oracle建立表空间和用户
- ios6前后分别如何处理内存警告
- You Never Really Learn Something Until You Teach It