mysql query from hourly to 2 hourly -


how can change query below 2 hours instead of 1

select date_format(x.time,'%y-%m-%d %h:00:00')      , avg(ph) avg_ph   ph x time >= now() - interval 1 day  group      date_format(x.time,'%y-%m-%d %h:00:00'); 

select date_format(from_unixtime(floor(unix_timestamp(x.time)/7200)*7200),'%y-%m-%d %h:00:00') `two_hour`      , avg(ph) avg_ph   ph x time >= now() - interval 1 day  group      `two_hour` 

Comments