Renier
Renier

Reputation: 1830

How do you order by negative and positive numbers DB2 Sql Syntax

When I run the following Sql I get the following results DB2 SQL :

    Select * from LOTOIL1 where lotkey = 'B20130806'
    order by OIPRI ASC

The results :

enter image description here

I am ordering on OIPRI and would like to get the results :

-3
-1
0
3

What do I need to do to get the results?

Thanks in advance.

Upvotes: 0

Views: 1942

Answers (1)

juergen d
juergen d

Reputation: 204864

Try

order by OIPRI * 1 ASC

to force integer conversion.

But actually you should change your data type to a numeric type.

Upvotes: 2

Related Questions