Home > php教程 > php手册 > body text

求一段查询sql,该如何处理

WBOY
Release: 2016-06-06 19:43:05
Original
1350 people have browsed it

求一段查询sql 数据库表有一个字段create_time,类型是int(10),存储的是对应的时间戳。 这个数据表已经存放了一年多的数据了 现在我要查询:create_time字段每天下午14:00到20:00的所有记录,请问这个sql应该怎么写? ------解决思路----------------------

求一段查询sql
数据库表有一个字段create_time,类型是int(10) ,存储的是对应的时间戳。
这个数据表已经存放了一年多的数据了

现在我要查询:create_time字段每天下午14:00到20:00的所有记录,请问这个sql应该怎么写?
------解决思路----------------------
select * from 表 where FROM_UNIXTIME(create_time, '%H:%i') BETWEEN ‘14:00' and '20:00'
---【本文来自鸿网互联 (http://www.68idc.cn)】---解决思路----------------------
不建议数据库里存unix时间戳,像你这个业务就必须用到函数,执行效率会下降
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!