SAPHANA学习(25):SQL Function(Y)
/*
154.YEAR(<date>)
返回年
YEARS_BETWEEN(<date_1>, <date_2>)
返回两个日期之间年份
*/
SELECT YEAR (TO_DATE ('2011-05-30', 'YYYY-MM-DD')) FROM DUMMY; --返回2 SELECT YEARS_BETWEEN(TO_DATE('2001-01-01'), TO_DATE('2003-03-14')) FROM DUMMY; --返回0,不满1年 SELECT YEARS_BETWEEN(TO_DATE('2004-01-01'), TO_DATE('2003-03-14')) FROM DUMMY; --返回-1 SELECT YEARS_BETWEEN(TO_DATE('2004-03-14'), TO_DATE('2003-03-14')) FROM DUMMY;
本文来自博客园,作者:渔歌晚唱,转载请注明原文链接:https://www.cnblogs.com/tangToms/p/13939799.html