MySql常用sql语句学习笔记

在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

扫描二维码关注公众号,回复: 591438 查看本文章

猜你喜欢

转载自timerbin.iteye.com/blog/2319370