码迷,mamicode.com
首页 > 数据库 > 详细

DB操作用法总结。

时间:2016-08-02 11:22:33      阅读:201      评论:0      收藏:0      [点我收藏+]

标签:

用到了慢慢总结。用到了随时更新。

其实可以看手册了。但是看了完了手册之后,还是记不住。

1. mysql select * from table where id in(1,2,3,3,4) 怎么能显示两次ID=3这一列?

select * from table where id in(1,2,3,4) union all select * from table where id =3
 
 

2. mysql select * from lsdl_user where id in (1,2,3,4,5)中in()最多能放多少数字

 in()中的个数是没有限制的, in(1,2,3)只是它的简单用法,如果你在学习in(),知道这样实现还不够,sql语句一般都是联合用的,比如 .........in(select uid from ........where .......) 如果你在学习php 应该知道 implode(), 比如 $uid_arr=array(..........); $uid_str=implode(‘,‘,$uid_arr);

 

DB操作用法总结。

标签:

原文地址:http://www.cnblogs.com/shaohef/p/5728358.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!