按Oracle SQL中其他字段中的唯一值计数

按Oracle SQL中其他字段中的唯一值计数,sql,oracle,Sql,Oracle,我有这样的桌子: Year Month Type 2013 4 31 2013 3 31 2014 5 40 2014 6 41 2015 5 31 2015 7 40 2013 4 31 2013 3 31 2014 5 40 2014 6 41 2015 5 31 2015 7 40 2013 4 31 2013 3 31 Year M

我有这样的桌子:

Year    Month   Type
2013    4   31
2013    3   31
2014    5   40
2014    6   41
2015    5   31
2015    7   40
2013    4   31
2013    3   31
2014    5   40
2014    6   41
2015    5   31
2015    7   40
2013    4   31
2013    3   31
Year    Month   Type    Count_of_appearance
2013    3   31  3
2013    4   31  3
etc..           
我想数一数每种组合的出现次数。所以输出应该是这样的:

Year    Month   Type
2013    4   31
2013    3   31
2014    5   40
2014    6   41
2015    5   31
2015    7   40
2013    4   31
2013    3   31
2014    5   40
2014    6   41
2015    5   31
2015    7   40
2013    4   31
2013    3   31
Year    Month   Type    Count_of_appearance
2013    3   31  3
2013    4   31  3
etc..           
我一直在使用类似于:

SELECT Year,
       Month,
       Type,
       (SELECT COUNT (*)
          FROM myTable
         WHERE (...im lost in defining a condition in order to make this work...)
           AS Count_of_appearance
  FROM employee;
我不知道如何定义函数WHERE子句


问题是我有很多像这样的字段和很多独特的值。表是8Gb大。

您正在查找的
分组依据:

SELECT Year, Month, Type, COUNT(*) AS Count_of_appearance
FROM employee
GROUP BY Year, Month, Type
ORDER BY Year, Month, Type;
为了确保结果的顺序正确,您还应该包括一个
orderby