Hi All,
Below is my MySQL table,
Transations ID TimeStamp
aaa 11 8/1/2013 6:27:15 PM
bbb 11 8/1/2013 6:30:25 PM
ccc 11 8/1/2013 6:32:25 PM
ddd 11 8/1/2013 7:32:18 PM
eee 11 8/1/2013 8:34:32 PM
fff 11 8/1/2013 9:34:32 PM
ggg 11 8/1/2013 9:40:32 PM
hhh 11 8/1/2013 10:00:00 PM
iii 11 8/1/2013 10:11:02 PM
jjj 11 8/1/2013 10:15:04 PM
kkk 11 8/1/2013 10:21:05 PM
bbb 11 8/1/2013 10:27:09 PM
I am using below MySQL query to fetch data between two dates,
SELECT DISTINCT Transaction_Name FROM `availabilitydb`.`transaction` WHERE Id=11 AND TimeStamp Between '8/1/2013 6:27:25 PM' AND '8/1/2013 9:34:32 PM'
The above query works properly and it gives me below data,
aaa
bbb
ccc
ddd
eee
fff
But when I change the date value in the between condition and use '8/1/2013 6:27:25 PM' AND '8/1/2013 10:27:09 PM' in the query, it does not give any output,
SELECT DISTINCT Transaction_Name FROM `availabilitydb`.`transaction` WHERE Id=11 AND TimeStamp Between '8/1/2013 6:27:25 PM' AND '8/1/2013 10:27:09 PM'
Output=> Blank
I dont know why this is happening, the query is not able to fetch data between
'8/1/2013 6:27:25 PM' AND '8/1/2013 10:27:09 PM'
The TimeStamp used in the above table is not Date, it is Varchar.
I think that's why it is not able to fetch the data, but it is only happening for below condition,
'8/1/2013 6:27:25 PM' AND '8/1/2013 10:27:09 PM'
Could you please check and let me know what can be done.
Thanks in advance,
Kane