I have the following table as follows
date hour click
2015-02-27 00 7
2015-02-27 01 7
2016-02-27 02 7
2016-02-27 02 8
2016-02-27 03 7
2016-02-27 04 9
. . .
. . .
2016-02-27 23 9
. . .
. . .
. . .
. . .
2016-03-02 00 9
2016-02-02 01 5
2016-02-02 02 18
We store the date in one column in hour in another column.
I need to select the range of rows where i pass the from date and hour to date and hour. I had get it for two different dates as follows.
select b.date, b.hour, sum(b.click)
from clickinfo b
where (b.date ='2016-01-27' and b.hour>='02')
or (b.date >'2016-01-27' and b.date <'2016-02-02')
or (b.date='2016-02-02' and b.hour<=05)
group by b.`date`, b.hour;
but i am not able to select the range for same day date and different hours.
That is from date - '2016-01-27' and hour -'05' to date - '2016-01-27'and hour = 23