Re: Select the most frequent value of each year in the db
A CTE gives the most elegant solution ...
with
a as (
select left(date,4) as year, lens, count(*) N
from tb_exifinfo
group by year,lens
),
b as (
select year, max(N) as maxN
from a
group by year
)
select a.year, a.lens, a.N
from a join b on a.year=b.year and a.N=b.maxN;
Subject
Written By
Posted
Re: Select the most frequent value of each year in the db
May 07, 2020 09:15AM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.