I have a mysql database with records from different companies. I need to select records from companies which have the most, second most and third most records and plot their number of records per year. How do I select them?
Many thanks.
EDIT:
The table would look something like this:
Company Year
A 1999
A 1999
B 1999
C 1999
A 2000
C 2000
A 2003
So if I select the company with the most records, A has the most records, and the output is;
Year Total
1999 2
2000 1
2003 1
And for the company with second most records, the output is ( in this case, company C)
Year Total
1999 1
2000 1
Third most will be company B.