答案 0 :(得分:0)
我认为这可以满足您的需求:
select t.*
from t
where t.time = (select min(t2.time)
from t t2
where floor(to_seconds(t2.time) / (30 * 60)) = floor(to_seconds(t.time) / (30 * 60))
);
答案 1 :(得分:0)
前几天想到答案:
SELECT FROM_
UNIXTIME(UNIX_TIMESTAMP(t.Time)- UNIX_TIMESTAMP(t.Time)%(15*60))
AS timekey,DB33,Stream,`View`,Coil
FROM (select DB33,Stream,`View`,Time,Coil from running_check where
DB33=#{DB33} ORDER BY id desc limit 10000) as t
GROUP BY timekey