区分oracle的提取月份

时间:2016-05-26 14:31:24

标签: oracle

以下是我从日期提取月份的查询,

    Select distinct  Extract (Month From Dates) As Bulan, Count(Matric_No) As Total,Matric_No
    From Stud_Sick
    Group By Matric_No,Dates
    Order By Dates;

这给了我错误'不是SELECTED表达式'。任何人都知道如何解决这个问题?

1 个答案:

答案 0 :(得分:1)

我怀疑你是否在以下情况之后:

select extract(month from dates) bulan,
       count(matric_no) as total,
       matric_no
from   stud_sick
group by extract(month from dates),
         matric_no
order by extract(month from dates);

或者你可能在以后:

select extract(month from dates) bulan,
       count(matric_no) as total
from   stud_sick
group by extract(month from dates)
order by extract(month from dates);