MySQL Forums
Forum List  »  Spanish

Re: Ayuda para ordenar una select
Posted by: Omar Piedehierro
Date: August 11, 2016 12:55AM

Al final se ha solucioando así:

select nodo
from arbol
order by
cast(substring_index(concat(nodo,'.0'),'.',1) as unsigned),
cast(substring_index(substring_index(concat(nodo,'.0'),'.',2),'.',-1) as unsigned),
cast(substring_index(substring_index(concat(nodo,'.0'),'.',3),'.',-1) as unsigned),
cast(substring_index(substring_index(concat(nodo,'.0'),'.',4),'.',-1) as unsigned),
cast(substring_index(substring_index(concat(nodo,'.0'),'.',5),'.',-1) as unsigned),
cast(substring_index(substring_index(concat(nodo,'.0'),'.',6),'.',-1) as unsigned),
cast(substring_index(substring_index(concat(nodo,'.0'),'.',7),'.',-1) as unsigned),
cast(substring_index(substring_index(concat(nodo,'.0'),'.',8),'.',-1) as unsigned),
cast(substring_index(substring_index(concat(nodo,'.0'),'.',9),'.',-1) as unsigned),
cast(substring_index(substring_index(concat(nodo,'.0'),'.',10),'.',-1) as unsigned)
;

Options: ReplyQuote


Subject
Views
Written By
Posted
954
August 10, 2016 03:28AM
Re: Ayuda para ordenar una select
607
August 11, 2016 12:55AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.