i have to query data in certain range of date and time. I have a ClearDB database in heroku with 2 fields to save date and time, these fiels are varchar type, not DATE. Data Structure here and don't look the field names, i have changed below in the querys for better understanding.
I have this query that works:
SELECT
DISTINCT dates, times, lat, long, ide FROM data
WHERE ide = 'lcg1234' AND (dates>= '2016-01-27' AND times>='15:00:00')
AND (dates<= '2016-01-29' AND times<='16:00:00')
ORDER BY times ASC
The problem is when i change the time in the last AND to a lower value like this:
SELECT
DISTINCT dates, times, lat, long, ide FROM data
WHERE ide = 'lcg1234' AND (dates>= '2016-01-27' AND times>='15:00:00')
AND (dates<= '2016-01-29' AND times<='01:00:00')
ORDER BY times ASC
It not work, why this happend? any ideas are wellcome! and sorry for my bad english.