根据时间查询往后推迟
https://www.it610.com/article/1292258749565706240.htm
1.1、MySQL加减某个时间间隔
设置当前日期变量
set @dt = now() – 设置当前日期
select @dt – 查询变量值
加减某个时间间隔函数date_add()与date_sub()
date_add(‘某个日期时间’,interval 1 时间种类名);
示例:
select date_add(@dt, interval 1 year); //加1年
select date_add(@dt, interval 1 month); //加1月
year:年,quarter:季,month:月,week:周,day:天,hour:小时,minuter:分钟,second:秒,microsecond:毫秒
注:也可以不用变量,直接加减某个时间,如:select date_add(‘2019-01-01’, interval 1 day);
select date_add(now(), interval 1 day); – 加1天
select date_add(now(), interval 1 hour); – 加1小时
select date_add(now(), interval 1 minute); – 加1分钟
select date_add(now(), interval 1 second); – 加1秒
select date_add(now(), interval 1 microsecond); – 加1毫秒
select date_add(now(), interval 1 week); – 加1周
select date_add(now(), interval 1 month); – 加1月
select date_add(now(), interval 1 quarter); – 加1季
select date_add(now(), interval 1 year); – 加1年
MySQL adddate(), addtime()函数,可以用date_add() 来替代。
此外,MySQL 为日期减去一个时间间隔:date_sub()
MySQL date_sub() 日期时间函数 和date_add() 用法一致。
MySQL 中subdate(),subtime()函数,建议,用date_sub()来替代。
select update_time from zz_statement where id = '116c77e1af4c18cd104f3fd8be22893'
2021-07-30 11:26:31
select date_add((select update_time from zz_statement where id = '116c77e1af4c18cd104f3fd8be22893'), interval 1 year);
2022-07-30 11:26:31
数据库查看某个字段重复的数据
select promoter_id,count(*) as c from zz_promoter group by promoter_id having c>1;
select replace(uuid(),"-","") as uuid;
INSERT INTO t_inventive_principle (`id`,`code_num`,`name`) VALUES (REPLACE(UUID(),"-",""),1,'分割原理');
oracle 时间匹配查询
select * from jk_cus_monitor where CREATE_DATE = to_date('2022-03-12 17:25:00' , 'yyyy-mm-dd hh24:mi:ss')
这辈子坚持与不坚持都不可怕,怕的是独自走在坚持的道路上!!!