Skip to content
Advertisement

Count of Value column with case when and group by

Table:

Output:

The aim is to create Max_year_count-Min_year_count per Id.
For example, calculation in Value column :
(count of occurrence of value in max_year with group by Id)-(count of occurrence of value in min_year with group by Id)
Thanks !!

Advertisement

Answer

Oracle supports FIRST/LAST for aggregates:

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement