I am writing a stored procedure for displaying month and year. It is working, but it is not returning the rows in the desired order.
ALTER procedure [dbo].[audioblog_getarchivedates]
as
begin
select DateName(Month,a.createddate) + ' ' + DateName(Year,a.createddate) as ArchiveDate
from audio_blog a
group by DateName(Month,a.createddate) + ' ' + DateName(Year,a.createddate)
order by DateName(Month,a.createddate) + ' ' + DateName(Year,a.createddate) desc
end
Results will come like this:
March 2010
January 2010
February 2010
But that is not in a order (desc).