我想从日期列中提取年,月,周和季度。我使用datepart()但它不起作用,我的SQL开发人员一直说它是无效指标。谢谢!
答案 0 :(得分:0)
select to_char(sysdate,'YYYY') Year,
to_char(sysdate,'MM') MonthNum,
to_char(sysdate,'DD') DayNum,
to_char(sysdate,'MONTH') MonthName,
to_char(sysdate,'DAY') DayName,
to_char(sysdate,'Q') Quarter
from dual;
会给你这个:
2015, 08, 07, AUGUST, FRIDAY, 3