mysql - select query for minus one hour -
have below query:
select hr, red (select hour(event_datetime) hr, max(red_kills) - (select max(red_kills) vwmatchall date_format(event_datetime,"%y-%m-%d %h") = date_format(date_sub(event_datetime, interval 1 hour), "%y-%m-%d")) red vwmatchall date(event_datetime) = '2015-10-09' group hour(event_datetime)) k
the data structured such:
the idea take current max() value of given column, red_kills in above example, , subtract max() value of same column, 1 hour previous. it's show difference hour. if 1 date doesn't have data 24 hours, still show data hours have. idea what's wrong query?
Comments
Post a Comment