Database yearwise count sql