Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想根据不同的日期从表中获取行。尽管日期的值并不总是相同的。
基本上我必须首先获取日期范围,然后根据这些日期提取列的行。
我不能做SELECT COUNT(location) FROM tweets WHERE date<= NOW()或date<=2012-07-29 17:38:32
SELECT COUNT(location) FROM tweets WHERE date<= NOW()
date<=2012-07-29 17:38:32
因为正如我所说,日期不固定。我不放日期,但它们是动态创建的。
好吧,关键是如何生成日期,但查询很简单:
$start = '2012-6-24'; $end = '2012-7-24'; "SELECT COUNT(location) FROM tweets WHERE date between '$start' and '$end'";