Home > Backend Development > PHP Tutorial > PHP查找一周内的数据 和一段范围的数据 如何写SQL

PHP查找一周内的数据 和一段范围的数据 如何写SQL

WBOY
Release: 2016-06-13 12:43:08
Original
919 people have browsed it

PHP查找一周内的数据 和一段范围的数据 怎么写SQL
字段是 时间戳的

网上搜索这样不行的
 7天

  SELECT * FROM `表名` where DATE_SUB(CURDATE(), INTERVAL 7 DAY) 
  /*DATEDIFF(now() , FROM_UNIXTIME(`时间字段名`)) = 7; //时间字段 存储类型为时间戳*/


$wheresql .=" AND datediff(now(),FROM_UNIXTIME(`paidan_time`))=7 ";

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 Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template