Skip to Content
author's profile photo Former Member
Former Member

Problemas ordenando tabla por campo de tipo entero con valores iniciales

Hola. Tengo esta tabla

SOLNR

000

000

001

000

002

003

Cuando hago: SORT 'table_name' BY SOLNR ASCENDING.

Obtengo esto:


SOLNR

000

000

001

002

003

Pero necesito esto:

001

002

003

000

000

Por favor alguien que me ayude

Gracias

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • author's profile photo Former Member
    Former Member
    Posted on Jul 25, 2014 at 08:12 PM

    Hola Sergio, gusto en saludarte.

    Imagino que lo que estas usando no es SQL, por la sintaxis que ocupas.

    Desconozco el lenguaje que estas utilizando, pero por el nombre del campo, creo que estas trabajando sobre R/3 y no sobre Business One:

    Si fuese SQL, lo que haria es transformar la columna mediante un CASE y luego ordenar por esta columna transformada.
    La sintaxis de esto seria algo como:

    SELECT CASE WHEN SOLNR='000' THEN '999' ELSE SOLNR END [Ordernar]
    , SOLNR
    FROM <TABLA>
    ORDER BY Ordenar

    slds.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.