Reputation: 161
I'm building a KPI Dashboard so that we can internally track client leads. I'd like to be able to show all leads between two dates, but unfortunately I can't get the query to display any results.
Here is a screenshot of what happens when no filters have been applied to the query. (I have echoed the query above the results for debugging)
Here is a screenshot after a few filters have been applied.
Here is a screenshot with a between dates filter applied.
I can't seem to find what the problem is. I even tried to force the correct date format in the query although the date column in the database is set to 'date'. As you can see from the other screenshots, records do exist between those two dates.
Any ideas?
Upvotes: 1
Views: 392
Reputation: 169
I think that your dates from BETWEEN section are calculated by MySQL eg. 2015-01-15 = 1999 - and that is the problem.
Try:
SELECT * FROM kpilead WHERE DATE(date) BETWEEN '2015-01-15' AND '2017-02-16' ORDER BY date DESC;
Upvotes: 4