Page 1 of 1

plz send me the query ans

Posted: Tue Mar 06, 2007 9:14 am
by srinu_a47
i cerated a table 'num' in that table i create a column 'sno'.
In that colum i enter the numbers 1 to 10.
my required output is
1 2 3 4 5 10 9 8 7 6

plz tell me how to display above output using sql

Posted: Tue Mar 06, 2007 11:25 pm
by shhuang
maybe this is not a perfect idea........share to everyone

select * from (
select sno
from num
where sno <= 5
order by sno asc)
union all
select * from (
select sno
from num
where sno > 5
and sno <= 10
order by sno desc)

Posted: Wed Mar 07, 2007 1:40 am
by ahmadbilal
create a function with loop and in loop concat variable value to lloing value return concatednated variable