摘要: SELECT uid, SUBSTR(addtime,1,10) as 创建日期, endtime, TIMESTAMPDIFF(MINUTE, addtime, endtime) as 直播时长 from room where addtime>='2016-11-08 00:00:00' and addtime= "2017-01-09 0... 阅读全文
posted @ 2017-05-26 11:37 Xiao|Deng 阅读(2731) 评论(0) 推荐(0) 编辑
摘要: select doll_name, type, value concat( left(get /(get+ fall)*100, 5), '%') as 抓取概率 from doll_conf 阅读全文
posted @ 2017-05-26 11:31 Xiao|Deng 阅读(3125) 评论(0) 推荐(0) 编辑
摘要: --CAST(xxx AS 类型) --CONVERT(xxx,类型) --#浮点型转化为int --i='3.35' --cast(i as signed) --cast(sum(money/100) as signed) as 提现总额, --二进制,同带binary前缀的效果 : BINARY --字符型,可带参数 : CHAR() --日期 : DATE --时间: TIM... 阅读全文
posted @ 2017-05-26 11:30 Xiao|Deng 阅读(3997) 评论(0) 推荐(0) 编辑
摘要: --#DESC降序排列, --默认升序排列 select * from room where uid='1329907' order by addtime DESC ----- 根据 “列” 从小到大排列 --select * from 表 order by 列 asc ----- 根据 “列” 从大到小排列 --select * from 表 order by 列 desc ... 阅读全文
posted @ 2017-05-26 11:29 Xiao|Deng 阅读(33919) 评论(0) 推荐(1) 编辑
摘要: replace(str,from_str,to_str) --用字符串to_str替换字符串str中的子串from_str并返回 --mysql> select replace('www.mysql.com', 'w', 'ww'); -- -> 'wwwwww.mysql.com' --SUBSTR(addtime, 1, 10) --substr(string string,num ... 阅读全文
posted @ 2017-05-26 11:25 Xiao|Deng 阅读(607) 评论(0) 推荐(0) 编辑
摘要: --1)查询时忽略重复值 SELECT DISTINCT City FROM Student --2)查询成绩分布分布情况 SELECT DISTINCT(Score), Count(ID) FROM Student GROUP BY Score --学生成绩可能重复,以此得到分数、得到这一成绩的学生数。 --DISTINCT是关键词 select count(DISTINCT... 阅读全文
posted @ 2017-05-26 11:24 Xiao|Deng 阅读(533) 评论(0) 推荐(0) 编辑
摘要: --select num from 表 group by num --select num from 表 group by num,nid --特别的:group by 必须在where之后,order by之前 --select num,nid from 表 where nid > 10 group by num,nid order by nid desc -- group by是关... 阅读全文
posted @ 2017-05-26 11:23 Xiao|Deng 阅读(1046) 评论(0) 推荐(0) 编辑
摘要: 2017-05-26--SUBSTR(addtime, 1, 10) --substr(string string,num start,num length); --string为字符串 --start为起始位置 --length为长度 SELECT d.uid, SUBSTR(u.addtime, 1, 10) as 注册时间, d.cid as cid F... 阅读全文
posted @ 2017-05-26 11:14 Xiao|Deng 阅读(238) 评论(0) 推荐(0) 编辑