I have the following query
select year, name, count(*) as c from product
group by year, name order by year, c desc limit 10
which is producing
+----+------------+------+
|year|name |c |
+----+------------+------+
|2007| A| 913|
|2007| J| 814|
|2007| M| 565|
|2007| C| 453|
|2007| S| 414|
etc.
year column has 2007 through 2017.
How can I find the the top 3 name
per year?
I've been trying with rank and dense_rank, but no luck.
I feel like I'm close, but just not there.
Database doesn't matter, I'm looking more for conceptual here than db specific. I can translate it as needed I suppose.
Thanks in advance