RELATEED CONSULTING
相关咨询
选择下列产品马上在线沟通
服务时间:8:30-17:00
你可能遇到了下面的问题
关闭右侧工具栏

新闻中心

这里有您想知道的互联网营销解决方案
oracleadd_months函数的用法详解

如果需要取上一个月的数据,并且每天都要进行此操作,每次都需要改时间,的确非常的麻烦,所以想到了oracle add_months函数这个函数

oracle add_months函数:

oracle add_months(time,months)函数可以得到某一时间之前或之后n个月的时间

 
 
 
  1. 如 select add_months(sysdate,-6) from dual;

该查询的结果是当前时间半年前的时间

 
 
 
  1. select add_months(sysdate,6) from dual;

该查询的结果是当前时间半年后的时间

 
 
 
  1. my examle:
  2. select distinct(t.mobile) from twaplogon t where to_char(t.logontime,'yyyy-mm')=to_char(add_months(sysdate,-1),'yyyy-mm')

以上就是oracle add_months函数的使用方法。


文章标题:oracleadd_months函数的用法详解
分享地址:http://www.jxjierui.cn/article/cdghopo.html