In MySql database have AM_TIMETABLE table in that
UserId DateTime
101 2012-08-08 04:00:00
102 2012-08-15 10:00:00
103 2012-08-18 09:00:00
104 2012-08-24 05:00:00
My Question is, i'm passing start-date and end-date then i'll get DateTime column date
for ex:
select * from AM_TIMETABLE where DateTime<='2012-08-08 00:00:00' and DateTime>='2012-08-20 00:00:00'
then i will get 101,102,103 UserId's value.
but i'm getting error please help
解决方案
This might work better:
select * from AM_TIMETABLE where `DateTime`<='2012-08-20 00:00:00' and `DateTime`>='2012-08-08 00:00:00'
DateTime might also be a reserved word, not so sure about that. If that's the case, you need backticks around them (a single ` before and after)