ITeye博客

MySql常用sql语句学习笔记

TimerBin · 2016-08-22 10:49 · mysql · 编程语言 · Markdown

在MySql中常用的几种查询:

 

一、根据条件按字段分组查询,条数大于1的所有数据列表:

select a.type,count(1) as sum from user  a where a.type >2 group by a.type having sum >2

 查询出来的结果如下所示:


 

二、数据库中表时间字段与字符串:

select * from user where unix_timestamp(created_time) > unix_timestamp('2016-08-16 00:00:01');

 使用unix_timestamp函数对时间字符串进行转义,然后再进行判断!

具体可参考:http://timerbin.iteye.com/admin/blogs/2037840

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。