Home >Backend Development >PHP Tutorial >求一sql查询语句

求一sql查询语句

WBOY
WBOYOriginal
2016-06-23 14:27:391077browse

表    名:archives
字    段:writer    pubdate
数据格式: 张三     1384858337

writer=作者名称
pubdate=提交时间

我需要列出作者为张三当日提交的所有数据,求sql查询语句。
注:因为时间戳纯数字,所以考虑是否有必要把时间戳格式化为:%Y-%m-%d %h:%i。


回复讨论(解决方案)

 select * from archives where date_format(FROM_UNIXTIME(pubdate),'%Y-%m-%d')=curdate() and writer='张三';

select * from archives where writer='张三' and pubdate between unix_timestamp(date(now)) and unix_timestamp(date(adddate(now(),1)));	

select * from archives where writer='张三' and pubdate between unix_timestamp(date(now())) and unix_timestamp(date(adddate(now(),1)));	

Statement:
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