2016-10-18 2 views
0

나는이 (나무 차 내림차순 출력)와 같은 내림차순 출력을 할 수있는 방법Matherial 경로 트리 출력

b 
b1 
b11 
c  
c1 
d  
e  
f  
g 
g1 

같은 matherial 경로와 열이?

g 
g1 
f 
e 
d 
c 
c1 
b 
b1 
b11 

답변

0

당신은 아스키 기능을 사용할 필요가

create table t(col varchar(10)); 
insert into t 
select 'b' union all 
select 'b1' union all 
select 'b11' union all 
select 'c' union all 
select 'c1' union all 
select 'd' union all  
select 'e' union all  
select 'f' union all  
select 'g' union all 
select 'g1'; 

select * from t 
order by 
ascii(col) desc, 
length(col) ; 

결과

col 
g 
g1 
f 
e 
d 
c 
c1 
b 
b1 
b11 

SQLFiddle 링크 http://sqlfiddle.com/#!9/eaf954/4

입니다