1

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?

1 Answer 1

4

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;
Sign up to request clarification or add additional context in comments.

1 Comment

Worked perfectly! Didn't even consider that it might be calculating it :) Thank you!!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.