如何使用日期格式作为时间戳显示两个特定日期之间的数据


how to display data between two specific dates with date format as timestamp

我正在尝试显示两个特定日期之间的表中的数据,日期格式为时间戳。

此查询在没有日期的情况下工作正常。

 SELECT table1.username,COUNT(table2.userid) as total FROM table2  INNER JOIN table1 
ON table1.userid = table2.userid GROUP BY table1.username 
      ORDER BY COUNT(table2.userid) DESC 

我正在使用下面的查询来获取两个特定日期之间的数据。 但它不显示任何内容

    SELECT table1.username,COUNT(table2.userid) as total FROM table2  
    WHERE table2.date between '2015-01-0' and '2015-01-30'  INNER JOIN table1 ON 
table1.userid = table2.userid GROUP BY table1.username 
      ORDER BY COUNT(table2.userid) DESC 

尝试

SELECT table1.username,COUNT(table2.userid) as total 
FROM table2  
INNER JOIN table1 ON table1.userid = table2.userid 
WHERE table2.date between '2015-01-0' and '2015-01-30'
GROUP BY table1.username 
  ORDER BY COUNT(table2.userid) DESC 

我想我们不能在编写连接之前使用 where 子句。