Retrieve rows from database and return count by year.