新聞中心
這里有您想知道的互聯(lián)網(wǎng)營(yíng)銷(xiāo)解決方案
oracleadd_months函數(shù)的用法詳解
如果需要取上一個(gè)月的數(shù)據(jù),并且每天都要進(jìn)行此操作,每次都需要改時(shí)間,的確非常的麻煩,所以想到了oracle add_months函數(shù)這個(gè)函數(shù)

oracle add_months函數(shù):
oracle add_months(time,months)函數(shù)可以得到某一時(shí)間之前或之后n個(gè)月的時(shí)間
- 如 select add_months(sysdate,-6) from dual;
該查詢(xún)的結(jié)果是當(dāng)前時(shí)間半年前的時(shí)間
- select add_months(sysdate,6) from dual;
該查詢(xún)的結(jié)果是當(dāng)前時(shí)間半年后的時(shí)間
- my examle:
- 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函數(shù)的使用方法。
當(dāng)前標(biāo)題:oracleadd_months函數(shù)的用法詳解
網(wǎng)址分享:http://www.5511xx.com/article/cdghopo.html


咨詢(xún)
建站咨詢(xún)
