I'm trying to count the dates, from the second table, it showing wrong, but actually must count 3 of day 29 and 1 count of day 30. But it's counting from each one. So the error is from the time. And I can't see the solution.
Another problem with query is that I can't transform the mysql to HQL, the problem I can't JOIN(SELECT and FROM(SELECT