鼎鼎知识库
Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

BEGIN
SELECT SUM(power),yyyymmdd FROM powers WHERE monthweekday="HOURS" AND StartTime<=STR_TO_DATE(yyyymmdd,'%Y%m%d%H') AND EndTime>=STR_TO_DATE(yyyymmdd,'%Y%m%d%H') GROUP BY yyyymmdd;
END
select count(*) from breakerdatas where mac='98CC4D213004'
select count(*) from breakerdatas where mac='187ED53338C4'
select count(*) from breakerdatas where mac='187ED53159E4'
select count(*) from breakerdatas where mac='98CC4D213003'

delete from breakerdatas where mac='187ED53338C4' and str_to_date(CreateTime, '%Y-%m-%d %H:%i:%s') <= str_to_date('2021-02-23 18:54:00', '%Y-%m-%d %H:%i:%s')

select CreateTime, mac, addr from  breakerdatas where mac='187ED53338C4' and addr='1' and str_to_date(CreateTime, '%Y-%m-%d %H:%i:%s') >= str_to_date('2021-02-23 19:30:00', '%Y-%m-%d %H:%i:%s')

select * from  breakerdatas where mac='187ED53338C4' and str_to_date(CreateTime, '%Y-%m-%d %H:%i:%s') >= str_to_date('2021-02-23 19:30:00', '%Y-%m-%d %H:%i:%s')

select * from  breakerdatas where mac='187ED53338C4' and str_to_date(CreateTime, '%Y-%m-%d %H:%i:%s') >= date_sub(now(), interval 1 hour)

select mac, addr, CreateTime from breakerdatas where mac='187ED53338C4' and addr='1' ORDER BY CreateTime desc

select count(*) from breakerdatas where mac='187ED53338C4' and addr='1'


select str_to_date(CreateTime, '%Y-%m-%d %H:%i') as dt, mac, addr, A_WP from  breakerdatas where mac in ('98CC4D213004','187ED5333333') and addr in ('1','2') and str_to_date(CreateTime, '%Y-%m-%d %H:%i:%s') >= str_to_date('2021-03-19 14:00:00', '%Y-%m-%d %H:%i:%s')

select str_to_date(CreateTime, '%Y-%m-%d %H:%i') as dt,sum(A_WP) as wp from  breakerdatas where mac in ('98CC4D213004','187ED5333333') and addr in ('1','2') and str_to_date(CreateTime, '%Y-%m-%d %H:%i:%s') >= str_to_date('2021-03-19 14:00:00', '%Y-%m-%d %H:%i:%s') group by dt