鼎鼎知识库
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

2021.2.3好用的sql语句.md 1.3KB

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'