I was trying to order by my wish. But i m unable to do.
select * from #tempmonthly with(nolock) order by hub_id(sorted,12,1,20,2,136,3,9,4,1,5,652,6,672,7,129,8,240,9,17,10,14,11,627,12,18,13,574,14,158,15,145,16)
I tried this, but i got error
'hub_id' is not a recognized built-in function name.
Working code is as follows:
select * from #tempmonthly with(nolock) order by hub_id
Guide me[as i want to arrange by my own order by].
I tried to google it. I got this answer like this
order by decode( sorted, 'F',1, 'C',2, 'A',3, 'B',4, 'G',5, 'D',6, 'E',7, 8 )
So i tried to do that in my code:
select * from #tempmonthly with(nolock) order by hub_id (sorted,12,1,20,2,136,3,9,4,1,5,652,6,672,7,129,8,240,9,17,10,14,11,627,12,18,13,574,14,158,15,145,16)
But it is not working