SQL Server - Order by part of a result -


i wondering if lend me hand.

i have quite lengthy sql query.

what want break down column stores date , order results year. part of query follows:

select convert(char(8), dateadd(minute, -601, pay.expiry), 10)         dailydate  table  order dailydate 

this gives me 'dailydate' outputted in following format:

12-07-14 

the year last 2 digits.

is there way can sort results based on 2 digits?

any great.

cheers,

use query.

select convert(char(8), dateadd(minute, -601, dailydate ), 10) dailydate  table   order substring(convert(char(8), dateadd(minute, -601, dailydate ), 10), 7, 2),           substring(convert(char(8), dateadd(minute, -601, dailydate ), 10), 4, 2) 

Comments

Popular posts from this blog

javascript - Any ideas when Firefox is likely to implement lengthAdjust and textLength? -

matlab - "Contour not rendered for non-finite ZData" -

delphi - Indy UDP Read Contents of Adata -