selva kumar

selva kumar

  • NA
  • 557
  • 188.6k

how to Sorting date based on month?

May 18 2013 1:46 AM
hi friends this is my code....

select distinct convert(varchar,date,103)as date,convert(datetime,date,103)as date1 from [sample] order by date desc;

 if i m using this...

i m getting two columns.....like this...

date1                               date
05-12-2013         2013-12-05 00:00:00.000
20-08-2013         2013-08-20 00:00:00.000
09-07-2013         2013-07-09 00:00:00.000
07-06-2013         2013-06-07 00:00:00.000
04-05-2013         2013-05-04 00:00:00.000
07-03-2013         2013-03-07 00:00:00.000
18-02-2013         2013-02-18 00:00:00.000
10-01-2013         2013-01-10 00:00:00.000


this is my problem...i want to display date1 column only without changing order....how do i get that date column....help me as soon as possible....

Answers (4)