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

I am trying to display data from table between two specific dates, date format is timestamp.

This query is working fine without dates.

 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 

I am using below query to get data between two specific dates. but it does not display anything

    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 

Try

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 

I Guess we cannot use where clause before writing join.