Home  >  Article  >  Backend Development  >  字段存的是时间戳如何取当天的所有记录 SQL如何写

字段存的是时间戳如何取当天的所有记录 SQL如何写

WBOY
WBOYOriginal
2016-06-13 10:12:10935browse

字段存的是时间戳怎么取当天的所有记录 SQL怎么写
字段存的是时间戳怎么取当天的所有记录 SQL怎么写

------解决方案--------------------

SQL code
SELECT * from table where DATE(FROM_UNIXTIME(time))=DATE(NOW());<br><font color="#e78608">------解决方案--------------------</font><br><br>
SQL code
SELECT * FROM table WHERE DATE(FROM_UNIXTIME(time))=CURDATE();<br><font color="#e78608">------解决方案--------------------</font><br>
SQL code
SELECT * FROM table WHERE FROM_UNIXTIME(TIME, '%Y-%m-%d' ) =CURDATE();<br><font color="#e78608">------解决方案--------------------</font><br>以上写法均不推荐:<br><br>select * from `table` where `time` >= curdate()<br><div class="clear">
                 
              
              
        
            </div>
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